Favorite Vim Plugins of 2014

on vim

These are my favorite Vim plugins of 2014 ranked in no particular order.

Multiple Cursors

posts/favorite_vim_plugins_of_2014/multiple_cursors.gif

vim-multiple-cursors lets you select and edit multiple words at once. Very convenient for renaming variables. Coming from Sublime Text 2 this was one feature I couldn't live without.

Exchange

vim-exchange makes it easy to exchange text from one place to an other. I always found myself copying and pasting text and it usually took twice as long because I would accidentally overwrite my yanked text with the dw command. Now I can simply cxw on the first text and cxw to swap them.

Targets

targets.vim improves upon the "change inside brackets/quotes" functionality. You can change text inside a pair of brackets without being on the same line. Can change inside commas, pluses and more. A recent update now lets you quickly change arguments of methods.

I originally thought the plugin wasn't too useful and I don't like overwriting vim functionality but installed it anyway. It quickly became one of my favorites.

Smart gf

posts/favorite_vim_plugins_of_2014/smartgf.png

smeatgf.vim adds a command for quick method lookup. When you come across a method you are not familiar with, you can gf on the word to find the definition.

Super Tab

supertab allows you to use for insert completion. I know there are snippets out there that implements this but supertab handles all of the edge cases.

Indent Object

vim-indent-object implements a new selector based on indentation. This is very useful for moving around blocks of code or re-indenting pasted text and it's not possible to use yap.

One of my most used plugins.

Qargs

vim-qargs lets you invoke a command on all items in a quickfix menu. I use this with ack.vim to do a global search & replace.

Sneak

posts/favorite_vim_plugins_of_2014/vim_sneak.gif

vim-sneak implements a minimalist motion that jumps to any location specified by two characters. It searches through the whole file and can jump through matches.

Surround

vim-surround implements a surround function which lets you add, change or remove brackets/quotes from objects. Add brackets to a word with yswb. Take then away with dsb.

Highly recommended, this plugin is vital for productivity.

Operator Gsearch

vim-operator-gsearch implements a shortcut (g/) that grabs the text you motioned and searches with that in ack or whatever you have setup. This speeds up my workflow by not having to type in anything.

Ctrlp

posts/favorite_vim_plugins_of_2014/vim_sneak.gif

ctrlp.vim is a full-path fuzzy file, buffer, most recently used and tag finder. Hit ctrlP, type in the wanted file and select it.

I use this all the time. The given search engine isn't very efficient, so I replaced it with ag. Here is my script:

if executable("ag")
    let g:ackprg = 'ag --nogroup --nocolor --column'

    " Use Ag over Grep
    set grepprg=ag\ --nogroup\ --nocolor

    " Use ag in CtrlP for listing files. Lightning fast and respects .gitignore
    let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""'

    " ag is fast enough that CtrlP doesn't need to cache
    let g:ctrlp_use_caching = 0
endif

It's so fast cache can be turned off and will also respect your .gitignore files.

Tcomment

tcomment.vim provides an easy to use, file-type sensible commenter. Being able to quickly comment out paragraphs, lines and anything with a motion is very useful.

I usually couple this with the indenter plugin to quickly comment out if statements. (gcaI.)

Colorschemes

vim-colorschemes adds plenty of awesome colorschemes. I added leader shortcuts to quickly switch between some of my favorite colorschemes.

nnoremap <leader>cg :color gruvbox<CR>
nnoremap <leader>ch :color hybrid<CR>
nnoremap <leader>cr :color railscasts<CR>
nnoremap <leader>cd :color desertEx<CR>

Scratch

scratch.vim adds a scratch window for notes and hides when inactive. I use this for writing up a small todo list.