BLOG
My Favorite Vim Plugins
After a brief affair with another editor, I’m now back to using my beloved Vim again. What’s more, I decided to invest the time I should have put in years ago when I started using it, and learned to do things more efficiently. Besides reading Practical Vim and watching some VimCasts, I went through my list of plugins I collected over the years, removed the ones I wasn’t using, learned about a couple of new ones I didn’t know, and re-learned some of the ones I forgot about. Here’s the list of my favorite plugins I ended up with.
pathogen
: Easy management of Vim plugins. I put all my Vim settings in a Git repository, and this plugin allows me to add plugins as a Git submodule somewhere in my settings tree. For an extensive tutorial, have a look at thepathogen
VimCast. Several other plugin managers (such asVAM
andVundle
) have emerged since I started usingpathogen
, but I haven’t tried them since this one does the trick for me.sensible
: Have sensible, safe defaults for a modern day Vim setup. Allows me to trim down my vimrc a bit.ctrlp
: Open files anywhere below your current directory very quickly, using fuzzy search. This is similar to Sublime’s “Go to anything” (which even uses the same shortcut). I almost exclusively open files usingctrlp
.unimpaired
: Easy to remember extra]
and[
shortcuts for a handful of useful tasks: cycling through files, buffers, arguments, SCM conflict markers, spelling errors; exchange lines, switch options, insert empty lines, … Also comes with shortcuts to toggle options, such ascol
(toggle invisible characters),con
(toggle number column),cos
(toggle spell correction), …detectindent
: Automatically detects whether tabs are expanded or not. Handy for working on multiple codebases with different tab preferences.a
: Switch between corresponding.h
and.(c|cpp|mm)
headers easilyack
: Lightning fast greps across a project. I actually useag
as backend.clang_complete
: C/C++ code completion that works. Requiresclang
to be on your system (which it is by default on MacOS X)endwise
: Automatically addsend
when you write abegin
, but does it conservatively so it never inserts anything unwanted.fugitive
. An extremely powerful Git integration for Vim. Apart from providing an interface for doing all kinds of (interactive) Git tasks from within Vim, also provides a status line entry for showing your current branch etc. There are a couple of VimCast episodes about how to use this plugin.abolish
: A set of search/replace/conversion commands that support plurals, case (MixedCase, camelCase, snake_case, …), … Can be used to rename variables easily, change case of avariable, … There are also some VimCasts about this plugin.gundo
: Graphical overview of Vim’s undo tree. If you undid a couple of changes, did some other stuff, and decided that your initial version was actually better, you can easily revert back. This has saved me and my undecisive mind a couple of times already. Also has a VimCast.matchit
: Match more than just braces with%
. Cycles through if/else, matches HTML/XML tags, …surround
: change/delete/add surrounding quotes, parentheses, tags, …syntastic
: Checks the syntax of your current file on save, and displays errors using markers in the sidebar. Saves you a round trip to your terminal when trying to compile/run the file.tagbar
: A navigation window with an overview of all functions/variables in your current file. Usesctags
behind the screens, but doesn’t require you to runctags
yourself on the codebase. It can also put an entry with the current function in your status bar (which is useful when editing files with large functions). This is similar to thetaglist
plugin, except that it takes into account scopes, which is useful in languages such as C++, Java, JavaScript, … For Markdown, I use the markdown2ctags script to generate tags.tcomment
: Quickly comment out lines and code blocks. I usedNERDCommenter
for a while, buttcomment
came with more natural Vim shortcuts (and is also supported by Vrapper). I also triedcommentary
(mostly because it’s by Tim Pope, and because it supportsrepeat
), which uses the same shortcuts, but this one doesn’t comment indented code blocks the way I want it to (i.e. put the indentation after the comment string instead of in front).easymotion
: Makes it easy to jump to any word in your buffer, by assigning a single letter to each word, highlighting it, and drilling down with each keystroke. Although this plugin is probably as fast and intuitive as it gets, in a GUI mode, it may be a tad faster to simply reach for the mouse and click in the document. However, when editing remote files without mouse support, this plugin is great!snipmate
: An engine for inserting snippets of code. There’s also a standard repository of standard snippets, but I mostly only use my own snippets for larger snippets (e.g. create a new class, insert copyright headers, …). Downsides: it no longer works withclang_complete
(although it used to), and it seems hard to override already existing snippets (which is why I don’t use the default repository).mru
: Easily access recently opened files through the MRU list.dispatch
: Asynchronous version of:make
, so you can still edit your code while your project is building. The downside is that it requires iTerm on MacOS X or fires off a separate command shell on Linux and Windows, so it’s still not as nice as a native window running a build in its own thread, but it gets the job done.NERDtree
: A better file system explorer than the default one. I don’t really use it that often (since I usectrlp
to open files), but it’s handy for when you need to look around your project tree.repeat
: ‘.
’ support for some of the plugins I use.speeddating
: Increment dates usingCtrl-A
/Ctrl-X
. Not that I often do this, but since it just adds extra support toCtrl-A
/Ctrl-X
, I just load it.exchange
: Exchange pieces of text quickly.argtextobj
Adds a text-objecta
for deleting/changing/selecting a function argument.ipmotion
Improves the paragraph motion behavior for lines with only whitespace.molokai
: A beautiful dark gray color scheme, based on the Monokai scheme from TextMate, and popular in other modern editors as well.- Vrapper: Not really a Vim plugin, but worth the mention: this Eclipse plugin provides a wide variety of Vim bindings to use inside Eclipse, so you can stay efficient when working on Java/Eclipse projects.