vimrc: reinstate that super-useful highlighting of trailing whitespace
[msysgit.git] / share / vim / vimrc
blob0d8cd4daf13b1dcc657fcd54832e324fe16ca8c5
1 " Setting some decent VIM settings for programming
3 set ai                          " set auto-indenting on for programming
4 set showmatch                   " automatically show matching brackets. works like it does in bbedit.
5 set vb                          " turn on the "visual bell" - which is much quieter than the "audio blink"
6 set ruler                       " show the cursor position all the time
7 set laststatus=2                " make the last line where the status is two lines deep so you can see status always
8 set backspace=indent,eol,start  " make that backspace key work the way it should
9 set nocompatible                " vi compatible is LAME
10 set background=dark             " Use colours that work well on a dark background (Console is usually black)
11 set showmode                    " show the current mode
12 syntax on                       " turn syntax highlighting on by default
14 " Show EOL type and last modified timestamp, right after the filename
15 set statusline=%<%F%h%m%r\ [%{&ff}]\ (%{strftime(\"%H:%M\ %d/%m/%Y\",getftime(expand(\"%:p\")))})%=%l,%c%V\ %P
17 "------------------------------------------------------------------------------
18 " Only do this part when compiled with support for autocommands.
19 if has("autocmd")
20     "Remember the positions in files with some git-specific exceptions"
21     autocmd BufReadPost *
22       \ if line("'\"") > 0 && line("'\"") <= line("$")
23       \           && expand("%") !~ "COMMIT_EDITMSG"
24       \           && expand("%") !~ "ADD_EDIT.patch"
25       \           && expand("%") !~ "addp-hunk-edit.diff"
26       \           && expand("%") !~ "git-rebase-todo" |
27       \   exe "normal g`\"" |
28       \ endif
30       autocmd BufNewFile,BufRead *.patch set filetype=diff
31       autocmd BufNewFile,BufRead *.diff set filetype=diff
33       autocmd Syntax diff
34       \ highlight WhiteSpaceEOL ctermbg=red |
35       \ match WhiteSpaceEOL /\(^+.*\)\@<=\s\+$/
37       autocmd Syntax gitcommit setlocal textwidth=74
38 endif " has("autocmd")