Adding some ideas from nvie's .vimrc (http://github.com/nvie/vimrc/raw/master/vimrc).
[dotfiles] / .vimrc
1 " Don't imitate vi.
2 set nocompatible
3
4 " Ignore certain file extensions when tab-completing.
5 set wildignore=*.swp,*.bak,*.pyc,*.class,*.o
6
7 " set filetype stuff to on
8 filetype on
9 filetype plugin on
10 filetype indent on
11
12 " Example filetype-specific setting:
13 " if has('autocmd')
14 "     autocmd filetype python set expandtab
15 " endif
16
17 " Show line numbers.
18 set number
19 set numberwidth=4
20
21 " Scroll five lines ahead of cursor.
22 set scrolloff=5
23
24 " Set up autoindentation.
25 set smartindent
26 filetype indent on
27
28 " Set tabs to width 4.
29 set softtabstop=4
30 set tabstop=4
31 set shiftwidth=4
32 set expandtab
33
34 " Allow backspacing over everything in insert mode
35 set backspace=indent,eol,start
36
37 "Highlight bad spacing
38 highlight BadSpacing term=standout ctermbg=cyan
39 augroup Spacing
40     autocmd!
41     " Highlight tabulators and trailing spaces
42     autocmd BufNewFile,BufReadPre * match BadSpacing /\(\t\|  *$\)/
43     " Only highlight trailing space in tab-filled formats
44     autocmd FileType help,make match BadSpacing /  *$/
45 augroup END
46
47 " Highlight search terms.
48 set hlsearch
49
50 " Search as you type.
51 set incsearch
52
53 " Display command and location status.
54 set ruler
55 set showcmd
56
57 " Multiple windows are equally sized and open in reading order.
58 set equalalways
59 set splitbelow splitright
60
61 " Line wrapping off
62 set nowrap
63
64 " Enlarge history and undo/redo buffers
65 set history=1000
66 set undolevels=1000
67
68 " Reset colors to a clean state.
69 if !has('gui_running')
70     set t_Co=8 t_md=
71 endif
72
73 " Enable syntax highlighting.
74 syntax enable
75
76 " Force vim to sync syntax highlighting from the beginning of the file.
77 syn sync fromstart
78
79 " Set the color scheme to desert.
80 colorscheme desert
81
82 " Unmap the arrow keys to prevent bad habits.
83 noremap  <Up> ""
84 noremap! <Up> <Esc>
85 noremap  <Down> ""
86 noremap! <Down> <Esc>
87 noremap  <Left> ""
88 noremap! <Left> <Esc>
89 noremap  <Right> ""
90 noremap! <Right> <Esc>
91
92