1 set nocompatible
 2 
 3 " A nice dark colorscheme
 4 colorscheme koehler
 5 
 6 " Use nice filespecific syntax highlighting
 7 filetype plugin indent on
 8 syntax on
 9 
10 " Tab -> 4 spaces
11 set backspace=2
12 set laststatus=2
13 set ts=4
14 set sw=4
15 set softtabstop=4
16 set expandtab smarttab autoindent
17 
18 " Show all commands and settings you can tab-complete to
19 set wildmenu
20 set wildmode=longest,list
21 
22 " Only use case-matching when you mix big and small chars
23 set ignorecase smartcase
24 
25 " Show what you are doing
26 set showmatch showcmd ruler hidden incsearch hlsearch
27 
28 " Disable spellchecking
29 set nospell
30 
31 " Underline the current line
32 set cul
33 
34 " Show line numbers
35 set number
36 
37 " Pretty menu with useful info about the current file
38 set laststatus=2
39 set statusline=%F%m%r%h%w%R\ %y\ [%l,%v][%p%%]
40 
41 " If you let go of Shift too slow in a :w
42 cab Q q
43 cab W w
44 
45 " Save a file with sudo
46 cmap w!! w !sudo tee % >/dev/null
47 
48 " If you write this in insertmode you probably ment something else
49 inoremap jj <Esc>
50 inoremap :wq <Esc>
51 
52 " Center on the match you searched for
53 map N Nzz
54 map n nzz
55 
56 " Previous and next buffer, useful together with 'gf'
57 nmap gb :bN<cr>
58 nmap gn :bn<cr>
59 
60 " Move up and down one line at a time even on linewrapped rows.
61 nnoremap <silent> k gk
62 nnoremap <silent> j gj
63 
64 " Disable menu when running gVim
65 if has("gui_running")
66     set guioptions-=T
67 endif
68 
69 " Set vim to chdir for each file you open
70 if exists('+autochdir')
71     set autochdir
72 else
73     autocmd BufEnter * silent! lcd %:p:h:gs/ /\\ /
74     " % current file name
75     " :p expand to full path
76     " :h head (last path component removed)
77     " gs/ /\\ /  replace " " with "\ "
78 endif