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.
Original Post, June 2 2008, Updated Oct 1 2009
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
" ****************** <span class="caps">INITIALIZE</span> ******************* set nocompatible " must be first line filetype plugin indent on " Automatically detect file types. syntax on " syntax highlighting " ****************** <span class="caps">VISUAL</span> ******************* color ir_black " load a colorscheme set cursorline " highlight current line hi cursorline guibg=#333333 " highlight bg color of current line hi CursorColumn guibg=#333333 " highlight cursor if has('cmdline_info') set ruler " show the ruler set rulerformat=%30(%=\:b%n%y%m%r%w\ %l,%c%V\ %P%) " a ruler on steroids set showcmd " show partial commands in status line and " selected characters/lines in visual mode endif if has('statusline') set laststatus=1 " show statusline only if there are > 1 windows set statusline=%<%f\ %=\:\b%n%y%m%r%w\ %l,%c%V\ %P " a statusline, also on steroids endif " <span class="caps">GVIM</span>- (here instead of .gvimrc) if has('gui_running') set guioptions-=T " remove the toolbar set lines=40 " 40 lines of text instead of 24, endif " ****************** <span class="caps">ENVIRONMENT</span> ******************* set backspace=indent,eol,start " backspace for dummys set showmatch " show matching brackets/parenthesis set wildmenu " show list instead of just completing set wildmode=list:longest,full " comand <tab> completion, list matches, then longest common part, then all. set shortmess+=filmnrxoOtT " abbrev. of messages (avoids 'hit enter') set showmode " display the current mode " set spell " spell checking on set nu " Line numbers on set tabpagemax=15 " only show 15 tabs set incsearch " find as you type search set hlsearch " highlight search terms set winminheight=0 " windows can be 0 line high set autowrite set whichwrap=b,s,h,l,<,>,[,] " backspace and cursor keys wrap to set ignorecase " case insensitive search set smartcase " case sensitive when uc present set backup " backups are nice set backupdir=$<span class="caps">HOME</span>/.backup " but they clog cwd set backupdir=~/.backup,~/tmp,.,/tmp"}}} set scrolljump=5 " lines to scroll when cursor leaves screen set scrolloff=3 " minimum lines to keep above and below cursor set foldenable " auto fold code "set foldmethod=marker " type of folding "set foldclose=all "set writebackup " ****************** <span class="caps">FORMATTING</span> ******************* " Formatting set nowrap " wrap long lines set autoindent " indent at the same level of the previous line set shiftwidth=4 " use indents of 4 spaces set noexpandtab " tabs are tabs, not spaces set tabstop=4 " an indentation every four columns "set matchpairs+=<:> " match, to be used with % set pastetoggle=<f12> " pastetoggle (sane indentation on pastes) "set comments=sl:/*,mb:*,elx:*/ " auto format comment blocks " ****************** <span class="caps">GENERAL</span> <span class="caps">SHORTCUTS</span> ******************* map <c-l> <c-w>_ map <c-j> <c-w>j<c-w>_ map <c-k> <c-w>k<c-w>_ map <s-h> gT map <s-l> gt " Stupid shift key fixes map:W :w map:<span class="caps">WQ</span> :wq map:wQ :wq map:Q :q autocmd BufEnter * lcd %:p:h " change directory the current file's "autocmd BufWritePost .vimrc source % " ****************** <span class="caps">CODING</span> ******************* if has("autocmd") && exists("+omnifunc") autocmd Filetype * \if &omnifunc == "" | \setlocal omnifunc=syntaxcomplete#Complete | \endif endif set completeopt+=menuone " show preview of function prototype " ****************** <span class="caps">PLUGINS</span> ******************* :map <c-f10> <esc>:vsp<cr>:VTree<cr> " map Control + F10 to Vtree let g:checksyntax_auto = 0 "comment out line(s) in visual mode vmap o :call NERDComment(1, 'toggle')<cr> let g:NERDShutUp=1 let b:match_ignorecase = 1 </cr></cr></cr></esc></c-f10></s-l></s-h></c-w></c-w></c-k></c-w></c-w></c-j></c-w></c-l></f12></tab>
See Also
External Resources
- A collection of .vimrc files
- Text editing with Vim
- Vim for Programmers
- Getting Started with VIM and PHP
- Comfortable PHP editing with VIM
- Technical Analysis: VIM, PowerShell and Signed Code
- Author of VIM
- Graphical vi-vim Cheat Sheet and Tutorial
- Great plain english tutorial for vim













