Full vimrc.

Pathogen vs Vundle

I’ve changed from Pathogen to Vundle, which had a tremendous improvement in control over my vim plugins.

Plugin 'gmarik/Vundle.vim'

The reason I believe Vundle is better, is because I previously managed all vim bundles with git submodule. Git submodule is just not for me. It’s issue is that it’s not intuitive for me to update modules. Especially for example when the repository contains a subfolder that is the bundle such as chriskempson’s tomorrow-night.

With Vundle, I can add tomorrow-theme/vim/ into the runtime path.

Plugin 'chriskempson/tomorrow-theme', {'rtp': 'vim/'}
colorscheme Tomorrow-Night
" or any of the other themes
" colorscheme Tomorrow
" colorscheme Tomorrow-Night-Blue
" colorscheme Tomorrow-Night-Bright
" colorscheme Tomorrow-Night-Eighties

Numbers

Plugin 'myusuf3/numbers.vim'
" in vim 704 you must set numbers
set number

Myusuf3’s numbers.vim is so awesome, if you haven’t seen it I think it’s probably the first thing you should check out. Essentially, normal mode has realtive line numbering, and insert mode has absolute line numbering.

Easymotion

Plugin 'Lokaltog/vim-easymotion'

If you thought numbers.vim was awesome, Lokatog’s vim-easymotion is even cooler! These are the tweaks I use. Easymotion recommends customizing to your needs. Also, in the current master vim-seek is pretty much implemented as a plug within easymotion. Insanely fast cursor positioning.

" EasyMotion
let g:EasyMotion_do_mapping = 0       " Disable default mappings
nmap s <Plug>(easymotion-bd-w)
nmap t <Plug>(easymotion-t2)
map  / <Plug>(easymotion-sn)
omap / <Plug>(easymotion-tn)
map  n <Plug>(easymotion-next)
map  N <Plug>(easymotion-prev)
map <Leader>l <Plug>(easymotion-lineforward)
map <Leader>j <Plug>(easymotion-j)
map <Leader>k <Plug>(easymotion-k)
map <Leader>h <Plug>(easymotion-linebackward)
let g:EasyMotion_startofline = 0      " keep cursor column when JK motion
let g:EasyMotion_smartcase = 1        " type `l` and match `l`&`L`
let g:EasyMotion_use_smartsign_us = 1 " type `3` and match `3`&`#`

Git and Gists

Plugin 'airblade/vim-gitgutter'
Plugin 'tpope/vim-fugitive'
Plugin 'mattn/webapi-vim'
Plugin 'mattn/gist-vim' " Depends on webapi-vim

" Fugitive
nmap <leader>gs :Gstatus<cr>

" Gist
"" sudo apt-get install xclip
let g:gist_clip_command = 'xclip -selection clipboard'
let g:gist_detect_filetype = 1
let g:gist_open_browser_after_post = 1
let g:gist_browser_command = 'firefox %URL%'
let g:gist_show_privates = 1
let g:gist_post_private = 1
  • vim-gitgutter, shows you additions and deletions in the gutter next to the numberline.
  • vim-fugitive, brings git to vim. Prefix git commands with ‘:G’ such as ‘:Gstatus’.
  • gist-vim, post the buffer to gist.github.com

Gundo

Plugin 'sjl/gundo.vim'

nnoremap <F5> :GundoToggle<CR>

Navigate vim’s undo tree. Yes, you heard me right. Undo tree, means undo two steps back and branch off. Don’t like that branch go back to the root and head back up to where you were before. Insane!

Snippets

Plugin 'SirVer/ultisnips'
Plugin 'honza/vim-snippets'

let g:UltiSnipsExpandTrigger="<tab>"
let g:UltiSnipsJumpForwardTrigger="<tab>"
let g:UltiSnipsJumpBackwardTrigger="<s-tab>"
let g:UltiSnipsEditSplit="vertical"
let g:ultisnips_python_style="google"

Snippets from textmate! You can even customize the docstring style, which is way impressive.

Surround

Plugin 'tpope/vim-surround'

Add characters around visually selected text. Change a pair of double qoutes to single quotes. Lot’s of useful manipulations of characters that surround text.

Syntax Checking

Plugin 'scrooloose/syntastic'

let g:syntastic_check_on_open=1
let g:syntastic_error_symbol='X'
let g:syntastic_warning_symbol='!'
let g:syntastic_auto_loc_list=2
let g:syntastic_loc_list_height=5

Syntax and Style checking in vim. Very useful. It has dependencies on external tools, for instance pylint. Very useful.

Code structure

Plugin 'majutsushi/tagbar'

nmap <F8> :TagbarToggle<CR>

So, I’ve looked at sublime-text’s minimap, and while these two things are not completely similar, I think tagbar is more useful in respects to understanding unfamiliar code quickly.

Python Virtualenv

Plugin 'jmcantrell/vim-virtualenv'

So, since I use virtualenv and virtualenvwrapper, without this plugin syntastic yells that imports of modules within a virtualenv don’t exist.