I write almost1 everything in vim. Few topics have as much written about them on the internet as vim’s benefits and usage do, so I won’t spend much time evangelizing it here.

In short, vim is a widely-used keyboard-centric editor that comes bundled with Linux and OS X2, and it’s pretty great.

It takes time to stop tinkering with vim configurations and plugins and arrive at the setup that works for you. I think I’ve reached that point recently, as evidenced by the fact that I haven’t made any big changes to my .vimrc in a long time.

These are the vim plugins that I use most frequently, or that are very useful even when I have rare occasion to use them.

Vundle

Vundle is a plugin manager for vim.

There are several vim plugin managers out there. E.g., Pathogen. I found Vundle very intuitive to use, but you might prefer other managers.

Once you’ve installed Vundle, installing other plugins is a breeze.

Say you want to install the ctrlp fuzzy file finder plugin. All you have to do is add this to your .vimrc:

" Taken from the url of the repo on GitHub:
" https://github.com/ctrlpvim/ctrlp.vim
Plugin 'ctrlpvim/ctrlp.vim'

Reload your .vimrc, then issue this vim command:

:PluginInstall

And Vundle will take care of the rest.

Even better, Vundle makes it easy to check for updates for all your installed plugins with this command:

:PluginUpdate

After it finishes checking for updates, Vundle lets you view a list of changelogs for all updated plugins.3 I’m a big proponent of changelogs, so I’m a big fan of the Vundle developer(s) for spending the time on that functionality.

badwolf

Install in Vundle:

Plugin 'sjl/badwolf'

badwolf is a vim colorscheme put together by Steve Losh.

badwolf color scheme

There are hundreds of vim color schemes out there and it’s not a good feeling – or use of your time – to keep going through them trying to find the one that clicks with you. Which is why I feel lucky to have come across badwolf. I haven’t had any urge to go look for a different one since I started using it many months ago.4

ctrlp.vim

Install in Vundle:

Plugin 'ctrlpvim/ctrlp.vim'

ctrlp is a fuzzy file and buffer finder that shows up above the vim status bar when you’re trying to find or edit another file.

You can tab (⇥) through the options, narrow them down by entering some text, or choosing a directory and listing its contents with the down (↓) key.

Goyo

Install in Vundle:

Plugin 'junegunn/goyo.vim'

Goyo is a plugin for “distraction-free writing in Vim”.

goyo

Goyo hides all of vim’s window elements (status bar at the bottom, gutter at the left), which gives you a clean writing environment like the one WriteRoom got famous for, and which many writing applications have implemented since.

I always turn it on (:Goyo) whenever I’m writing non-code text, including posts for this site.

lightline.vim

Install in Vundle:

Plugin 'itchyny/lightline.vim'

lightline.vim replaces vim’s boring retro-looking status bar with a prettier colorful one.

My configuration of it is boring and doesn’t show off many of its capabilities, so this will be the only time I don’t include a screenshot of my own and link to a screenshot on GitHub instead:

It’s even more customizable than the average vim plugin, which is a lot.

tcomment_vim

Install in Vundle:

Plugin 'tomtom/tcomment_vim'

tcomment_vim is a syntax-aware plugin for easy commenting. It’s so great and might be my most-used plugin.

It works like a toggle. You can highlight a line and type gc and tcomment_vim will comment the line out with the appropriate character(s) appropriate to the language you’re writing in. Type gc again and tcomment_vim will uncomment the line.

You don’t even have to highlight a line. You can just invoke it by typing gcc and it will comment out the line you’re on.

What I just described is the most basic of the plenty it can do.

vim-colors-pencil

Install in Vundle:

Plugin 'reedes/vim-colors-pencil'

vim-colors-pencil is the colorscheme I use with Goyo – you can see a screenshot of it up in the Goyo section. I’m a big fan of it when writing prose, but it’s not as good as badwolf for code.

I’ve customized my .vimrc to automatically enable vim-colors-pencil when I start Goyo mode, and revert back to badwolf when I leave Goyo mode:

function! s:goyo_enter()
    colorscheme pencil
endfunction

function! s:goyo_leave()
    colorscheme badwolf
endfunction

autocmd! User GoyoEnter nested call <SID>goyo_enter()
autocmd! User GoyoLeave nested call <SID>goyo_leave()

vim-easymotion

Install in Vundle:

Plugin 'easymotion/vim-easymotion'

vim-easymotion lets you jump around your document with ease and great precision.

There is a lot of complex configuration and usage that I won’t get into here, and that isn’t necessary for it to be useful to you.

I use vim-easymotion in two main ways: to jump to a specific word forward or backward relative to the cursor.

You can invoke the forward word jump with <leader><leader>w5.

If you want to jump to “fees”, press w. If you want to jump to “outpacing”, press ;g.

It’s awesome!

To invoke backward word jump, use the command <leader><leader>b.

Maybe you detect a theme: w is how you move one word ahead in vim, and b is how you move one word back.

vim-gitgutter

Install in Vundle:

Plugin 'airblade/vim-gitgutter'

vim-gitgutter shows signs for line additions (+), modifications (~), or removals (-) in the vim window gutter if the file you’re modifying is in a git repo.

It can do more than that, like allowing you to jump between hunks (blocks of changes). It is also highly customizable.

vim-indent-guides

Install in Vundle:

Plugin 'nathanaelkane/vim-indent-guides'

vim-indent-guides provides visual indicators of the indent level of each line in a file.

I write a lot of Python code, a language in which whitespace/indentation affects how the code is interpreted. It helps to have the indentations pointed out without having to rely only on the empty tab-sized spaces.

I customized the plugin to show the thinnest guides allowed by vim (single character wide) and use more subtle highlights:

let g:indent_guides_guide_size = 1
let g:indent_guides_color_change_percent = 3
let g:indent_guides_enable_on_vim_startup = 1

vim-table-mode

Install in Vundle:

Plugin 'dhruvasagar/vim-table-mode'

Creating tables in Markdown can be a pain. You either have to accept a table that looks horrible in raw text view because different rows have different widths:

| Key | Value |
|-----|-------|
| first_name | 'sherif' |
| last_name | 'soliman' |
| occupation | 'junior badass' |
| age | 403 |

Or you have to spend a lot of time adding and removing spaces over and over to fit each new entry.

vim-table-mode does a great job solving that problem.

Once you want to start composing or editing a Markdown table, invoke vim-table-mode’s table mode with <leader>tm. Now, each time you enter | to leave the cell and move on to the next cell or row, vim-table-mode will reflow the entire table to give you straight edges.

It’s beautiful to see in action and makes me smile whenever I use it. Here is the table above composed in table mode:

| Key        | Value           |
|------------|-----------------|
| first_name | 'sherif'        |
| last_name  | 'soliman'       |
| occupation | 'junior badass' |
| age        | 403             |

I did not have to type a single space or extra -.

As with almost all the plugins I’ve listed, I only described the most basic usage. You can do and customize quite a bit.

My only customization is:

let g:table_mode_corner="|"

To tell the plugin to use | instead of + for table corners.

YouCompleteMe

Install in Vundle:

Plugin 'Valloric/YouCompleteMe'

Last but not certainly not least, YouCompleteMe is an autocomplete plugin that makes writing Python code in vim a much nicer and easier experience.

It doesn’t only work with Python, but that’s what I use it for. It does too many things for me to list here and I don’t think I know a fraction of what it can do to attempt a summary. But I’ll say that I think it’s the best vim autocomplete plugin out there.

Closing note

This list hasn’t changed in a long time, but it won’t remain the same forever. I’ll make sure to add a link whenever enough has changed that it’s worth writing a Part II.

  1. I use Brackets when doing heavy css or sass work. I also use BBEdit for demanding text heavy-lifting.

  2. If you’re using OS X, I recommend you install vim or MacVim using Homebrew: brew install macvim. OS X’s vim lags behind and doesn’t get updated as frequently as Homebrew’s.

  3. Which it creates by listing the commit messages for all commits between the version you had and the version you downloaded.

  4. With the exception of vim-colors-pencil colorscheme which I use with Goyo. Keep reading.

  5. What’s a “leader”?