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