" --------------------------- " Anjul Patney's vimrc " --------------------------- syntax on " syntax highlighting set guifont=Courier_New:h12:b:cANSI " text font set backupdir=C:\tmp,c:\temp,. " avoid tempfile clutter set directory=c:\tmp,c:\temp,. " avoid tempfile clutter set nocompatible " use vim defaults set backspace=2 " allow backspacing of everything, including \n set tabstop=4 " set tabstop to 4 set shiftwidth=4 " set shiftwidth to 4 set expandtab " expand tabs to spaces set autoindent " autoindent new lines set nocindent " C-style indenting set nowrap " no wrapping by default set ruler " show ruler set ls=2 " show the filename at bottom ruler set hlsearch " highlight searched keywords set showcmd " show command in status line set showmatch " show matching brackets set ignorecase " case insensitive matching set smartcase " but case sensitive if uppercase letters are submitted set showmode " show the mode we're in set incsearch " incremental search set nosol " try to stay in same column when jumping set gdefault " assume the /g flag on :s substitutions set textwidth=0 " don't assume static text width if has('gui_running') colors morning " color scheme endif set number " display highlighted line numbers :highlight LineNr term=bold cterm=NONE ctermfg=DarkGrey ctermbg=NONE gui=NONE guifg=Black guibg=DarkGrey if has('gui_running') if has('spell') set spell " spellchecks can't hurt endif endif set scrolloff=3 " start scrolling bfore we reach bottom if has('autochdir') set autochdir " run in the current directory endif set listchars=tab:\|_,trail:·,eol:$ " what to display in list mode? "---------------------- " Command mappings "---------------------- noremap :update " Ctrl+S etc for saving vnoremap :update inoremap :update nmap ,s :source $MYVIMRC " reload vimrc nmap ,v :e $MYVIMRC " edit vimrc vmap >gv " tab to indent in visual mode vmap :vsp " F1 performs vsplit map {gq} " F2 formats paragraphs map :set list! " F3 toggles list mode map :N map :n " Special tab-based autocomplete inoremap =InsertTabWrapper() function! InsertTabWrapper() let col = col('.') - 1 if !col || getline('.')[col - 1] !~ '\k' return "\" else return "\" endif endfunction " --------------------------- " Common typos "--------------------------- " commands cabbr W w cabbr Q q cabbr wQ wq cabbr WQ wq cabbr Wq wq " days of week iab monday Monday iab tuesday Tuesday iab wednesday Wednesday iab thursday Thursday iab friday Friday iab saturday Saturday iab sunday Sunday " filetype specific stuff au FileType c set cindent tw=790 nospell au FileType matlab set ai et tw=780 nospell au FileType java set ai et cindent tw=780 nospell au FileType python set ai et tw=780 nospell au FileType perl set ai et tw=780 cindent nospell au FileType awk set ai et tw=780 nospell au FileType cpp set cindent tw=790 nospell au FileType php set ai et cindent tw=780 nospell au FileType html set ai et tw=780 nospell au FileType tex set ai et tw=70 nospell au FileType sh set ai et nospell au FileType scheme set ai et tw=780 lisp nospell au FileType lex set ai et nospell au FileType yacc set ai et nospell au FileType vim set ai et nospell au FileType babe set ai et nospell au FileType xml set ai et nospell au FileType sgml set ai et nospell