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 is a plugin manager for vim.
There are several vim plugin managers out there. E.g., Pathogen.
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, then issue this vim command:
Vundle will take care of the rest.
Vundle makes it easy to check for updates for all your installed plugins with this command:
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.
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
I haven’t had any urge to go look for a different one since I started using it many months ago.4
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 is a plugin for “distraction-free writing in Vim”.
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 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 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
tcomment_vim will comment the line out with the appropriate character(s) appropriate to the language you’re writing in.
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 is the colorscheme I use with
Goyo – you can see a screenshot of it up in the
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
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.
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
If you want to jump to “fees”, press
If you want to jump to “outpacing”, press
To invoke backward word jump, use the command
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 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 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:
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:
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
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:
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:
To tell the plugin to use
| instead of
+ for table corners.
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.
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.
Which it creates by listing the commit messages for all commits between the version you had and the version you downloaded. ↩︎
With the exception of
vim-colors-pencilcolorscheme which I use with
Goyo. Keep reading. ↩︎