Skip to content

Instantly share code, notes, and snippets.

@mattd
Created March 1, 2011 17:17
Show Gist options
  • Save mattd/849496 to your computer and use it in GitHub Desktop.
Save mattd/849496 to your computer and use it in GitHub Desktop.
" display settings
set autoindent
set number
set ruler
set showmatch
set showmode
set vb
syntax on
let g:zenburn_high_Contrast=1
colo zenburn
" for gvim/macvim
if has("gui_running")
set guioptions=egmrt
endif
" indentation settings
set tabstop=4
set shiftwidth=4
" plugin settings
filetype plugin on
map <F2> :NERDTreeToggle<CR>
" quickfix window shortcuts
map [o :copen<CR>
map [x :ccl<CR>
map [n :cn<CR>
map [p :cp<CR>
" location window shortcuts
map ]o :lopen<CR>
map ]x :lcl<CR>
map ]n :ln<CR>
map ]p :lp<CR>
" a quicker escape
inoremap jj <Esc>
" f5 removes all trailing whitespace
" see: http://vim.wikia.com/wiki/Remove_unwanted_spaces
nnoremap <silent> <F5> :let _s=@/<Bar>:%s/\s\+$//e<Bar>:let @/=_s<Bar>:nohl<CR>
" highlight trailing whitespace in normal mode
" see: http://vim.wikia.com/wiki/Highlight_unwanted_spaces
highlight ExtraWhitespace ctermbg=red guibg=red
match ExtraWhitespace /\s\+$/
autocmd BufWinEnter * match ExtraWhitespace /\s\+$/
autocmd InsertEnter * match ExtraWhitespace /\s\+\%#\@<!$/
autocmd InsertLeave * match ExtraWhitespace /\s\+$/
autocmd BufWinLeave * call clearmatches()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment