My Custom .vimrc file for VIM

Vim (text editor) in a terminal emulator, with...

Image via Wikipedia

Vim is a good editor, made great with a custom .vimrc file.
My .vimrc file adds syntax highlighting, autocomplete with tab, folding and highlights the line you are on.
Feel free to use or modify it for your needs.

VIM

I have a love hate relationship with VIM. I am extremely productive using it, yet I still think there must be a better editor out there. Despite years of trying out other editors, I always come back to vim. Quanta Plus was close, and notepad++ works well on windows, but I always ending up typing a lot of unnecessary j's and k's ;)

My .vimrc

Updated July 30, 2008
  1. if has('syntax') && (&t_Co > 2 || has('win32'))
  2. syntax on " enable syntax highlighting
  3. color dante " load a colorscheme, it's redundant to use
  4. endif
  5.  
  6. " VISUAL
  7. color dante " load a colorscheme
  8.  
  9. set cursorline " highlight current line
  10. hi cursorline guibg=#333333 " highlight bg color of current line
  11. hi CursorColumn guibg=#333333 " highlight cursor
  12.  
  13. if has('cmdline_info')
  14. set ruler " show the ruler
  15. " a ruler on steroids
  16. set rulerformat=%30(%=\:b%n%y%m%r%w\ %l,%c%V\ %P%)
  17. set showcmd " show partial commands in status line and
  18. " selected characters/lines in visual mode
  19. endif
  20.  
  21. if has('statusline')
  22. set laststatus=1 " show statusline only if there are > 1 windows
  23. " a statusline, also on steroids
  24. set statusline=%<%f\ %=\:\b%n%y%m%r%w\ %l,%c%V\ %P
  25. endif
  26.  
  27.  
  28. " ENVIRONMENT
  29. set backspace=indent,eol,start " backspace for dummys
  30. set showmatch " show matching brackets/parenthesis
  31. set wildmenu
  32. set wildmode=list:longest,full " comand <tab> completion, list matches and
  33. " complete the longest common part, then,
  34. " cycle through the matches
  35.  
  36. set shortmess+=filmnrxoOtT " abbrev. of messages (avoids 'hit enter')
  37. set showmode " display the current mode
  38. set spell " spell checking on
  39.  
  40. set nu " Line numbers on
  41. set tabpagemax=15 " only show 15 tabs
  42. filetype plugin indent on " Automatically detect file types.
  43. set incsearch " find as you type search
  44. set hlsearch " highlight search terms
  45.  
  46.  
  47. " Formatting
  48. set wrap " wrap long lines
  49. set autoindent " indent at the same level of the previous line
  50. set shiftwidth=4 " use indents of 4 spaces
  51. set noexpandtab " tabs are tabs, not spaces
  52. set matchpairs+=&lt;:&gt; " match, to be used with %
  53. set pastetoggle=<f12> " pastetoggle (sane indentation on pastes)
  54. set comments=sl:/*,mb:*,elx:*/ " auto format comment blocks
  55.  
  56. "set foldenable " auto fold code
  57. "set foldmethod=marker " type of folding
  58.  
  59. " CODING
  60. setlocal omnifunc=syntaxcomplete#Complete " activate autocomplete (intellisense)
  61. set cot+=menuone " show preview of function prototype
  62.  
  63. " GVIM- (here instead of .gvimrc)
  64. if has('gui_running')
  65. set guioptions-=T " remove the toolbar
  66. set lines=40 " 40 lines of text instead of 24,
  67. endif
  68.  
  69. " PLUGINS
  70. let g:SuperTabDefaultCompletionType = "<c-x><c-o>"
  71. " enable super tab
  72.  
  73. :map <c-f10> <esc>:vsp<cr>:VTree<cr>
  74. " map Control + F10 to Vtree

See Also

External Resources

AttachmentSize
vimrc.txt2.66 KB