-
Notifications
You must be signed in to change notification settings - Fork 4
/
vimrc
52 lines (46 loc) · 1.93 KB
/
vimrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
set background=dark
set nocompatible " use vim extensions
" Bells
set visualbell t_vb= " turn off error beep/flash
set novisualbell " turn off visual bell
" Editing info
set number "[same as nu] show line numbers
set ruler "[same as ru] show cursor position
set showmode "[same as smd] show when in insert mode
" Search
set hlsearch " highlight searches
set incsearch " do incremental searching
" Auxilary files
set nobackup " do not keep a backup file (ending in ~)
set noswapfile " do not write a swap file
" Smart editing
set showmatch "[same as sm] highlight matching (), {}, etc.
" Tabs and Indenting
set autoindent "[same as ai] always set autoindenting on
set shiftwidth=4 "[same as sw] number of spaces to (auto)indent
set tabstop=4 "[same as ts] number of spaces per tab
set expandtab "[same as et] use spaces instead of a tab
set softtabstop=4 "[same as sts] number of spaces to use instead of a tab
set smarttab "[same as sta] <BS> deletes shiftwidth spaces from the start of a line
" Syntax highlighting
syntax enable
autocmd FileType make setlocal noexpandtab
set tags=./tags,tags;$HOME
set listchars=eol:$,tab:>-,trail:~,extends:>,precedes:<
noremap <F5> :set list!<CR>
noremap <F6> :set number!<CR>
noremap <F7> :set paste!<CR>
nnoremap <Leader>s :%s/\<<C-r><C-w>\>/
set spelllang=en
noremap <F8> :set spell!<CR>
autocmd FileType gitcommit setlocal spell
autocmd BufRead *.rs :setlocal tags=./rusty-tags.vi;/
" Highlight trailing spaces
" http://vim.wikia.com/wiki/Highlight_unwanted_spaces
highlight ExtraWhitespace ctermbg=red guibg=red
match ExtraWhitespace /\s\+$/
autocmd BufWinEnter * match ExtraWhitespace /\s\+$/
autocmd InsertEnter * match ExtraWhitespace /\s\+\%#\@<!$/
autocmd InsertLeave * match ExtraWhitespace /\s\+$/
autocmd BufWinLeave * call clearmatches()
set viminfo+=n/tmp/viminfo