" Basic settings set autoindent " copy indent from current line for new lines. set autowrite " save a modified file if you suspend your session. set directory=/tmp " where your edit recovery file goes. set nobackup " don't make automatic backups, I'll handle that. set nomodeline " for security. set noremap " don't let key mappings work recursively. set redraw " redraw screen when VIM starts. set shell=/bin/sh " use this shell for external commands. set wm=2 " wrap line when 2 chars from right border. set writeany " allow writing a file without checking its mode. " Status line set ls=2 set statusline=%F%h%m%r%=chr:0x%B\ \ %l,%c%V\ %P " Key mappings map ; >> map = << map g map V }jmbk{ma}:'a,.!fmt -1\|fmt'b map q z. map E oi....+....1....+....2....+....3....+....4....+....5....+....6....+....7....+ " Date and time abbreviations inoremap ,d =strftime("%a, %d %b %Y %T %z") map ,t :.!sh -c 'line=`cat`; date -d "$line"' if has("unix") iab _day =strftime("%a, %d %b %Y") iab _date =strftime("%a, %d %b %Y %X %z") iab _time =strftime("%H:%M:%S") endif " Tabs set shiftwidth=4 set tabstop=4 set expandtab " Utility functions autocmd BufWritePre * ks|call TimeStamp()|'s function! TimeStamp() if &modified let lines = line("$") < 5 ? line("$") : 5 let pattern1 = '\(Last [Mm]odified:\).*' let replace1 = '\1' . strftime(" %a, %d %b %Y %T %z") execute printf('1,%ds/\C\m%s/%s/e', lines, pattern1, replace1) execute printf('$-%d+1,$s/\C\m%s/%s/e', lines, pattern1, replace1) let pattern2 = '\($Id: \f\+ \d\+\.\d\+\(\.\d\+\.\d\+\)*\)\(+\(\d\+\)\)\?' let replace2 = '\=submatch(1) . "+" . (submatch(4) + 1)' execute printf('1,%ds/\C\m%s/%s/e', lines, pattern2, replace2) execute printf('$-%d+1,$s/\C\m%s/%s/e', lines, pattern2, replace2) endif endfunction