Added bad whitespace highlighting.
[dotfiles] / .vimrc
1 " Don't imitate vi.
2 set nocompatible
3
4 " Show line numbers.
5 set number
6 set numberwidth=4
7
8 " Scroll five lines ahead of cursor.
9 set scrolloff=5
10
11 " Set up autoindentation.
12 set smartindent
13 filetype indent on
14
15 " Set tabs to width 4.
16 set softtabstop=4
17 set tabstop=4
18 set shiftwidth=4
19 set expandtab
20
21 "Highlight bad spacing
22 highlight BadSpacing term=standout ctermbg=cyan
23 augroup Spacing
24     autocmd!
25     " Highlight tabulators and trailing spaces (nasty bastards)
26     autocmd BufNewFile,BufReadPre * match BadSpacing /\(\t\|  *$\)/
27     " Only highlight trailing space in tab-filled formats
28     autocmd FileType help,make match BadSpacing /  *$/
29 augroup END
30
31 " Search as you type.
32 set incsearch
33
34 " Display command and location status.
35 set ruler
36 set showcmd
37
38 " Multiple windows are equally sized and open in reading order.
39 set equalalways
40 set splitbelow splitright
41
42 " Line wrapping off
43 set nowrap
44
45 " Reset colors to a clean state.
46 if !has('gui_running')
47         set t_Co=8 t_md=
48 endif
49
50 " Enable syntax "highlighting.
51 syntax enable
52
53 " Force vim to sync syntax "highlighting from the beginning of the file.
54 syn sync fromstart
55
56 " Set the color scheme to desert.
57 colorscheme desert
58
59 " Unmap the arrow keys to prevent bad habits.
60 noremap  <Up> ""
61 noremap! <Up> <Esc>
62 noremap  <Down> ""
63 noremap! <Down> <Esc>
64 noremap  <Left> ""
65 noremap! <Left> <Esc>
66 noremap  <Right> ""
67 noremap! <Right> <Esc>
68
69