My VIM Configuration
Posted by jason on May 21, 2011, 6:19 a.m.
I use VIM as my main IDE when doing any sort of dev work. So, I invested a few hours configuring things so that it would behave a bit more friendly for me. Here are some features in my configuration:
- Tab completion
- Syntax highlighting
- Capital "H" and "L" move left and right between open tabs
- Capital "Q" closes the current tab
- Backspace key is freed
- Tabs are 4 spaces
Here's the config file. Put it in ~/.vimrc or ~/.exrc. There's a download link at the bottom of this page.
syn on
set number
set tabstop=4
set shiftwidth=4
set autoindent
set showmode
set showcmd
set ruler
set backspace=start,indent,eol
set wrapscan
set incsearch
set ignorecase
set tags=tags;
set wildmenu
set wildmode=longest,full
set expandtab
nnoremap :TlistToggle
"also try wildmode=longest,full or longest,list
"
"to create nice aliases: 'imap ;EM jason@jason.com'
"
"“ Insert or complete identifier“ if the cursor is after a keyword
"character
function MyTabOrComplete()
let col = col('.')-1
if !col || getline('.')[col-1] !~ '\k'
return "\"
else
return "\"
endif
endfunction
inoremap =MyTabOrComplete()
set makeprg=php\ -l\ %
set errorformat=%m\ in\ %f\ on\ line\ %l
"Use H and L to switch between tabs
:map gT
:map gt
"Use Q to close tabs
:map :q
:filetype plugin on