My favorite Vim plugins

Once you get comfortable with Vim’s basic commands and editing capabilities, you will want to start
customizing your install. The 2 most common approaches are:

plugins

customized .vimrc

I will talk about my .vimrc in a future post, for now lets take a look at the plugins I found most useful.

Most vim plugins can be found on the official site but its not
the most user friendly site for finding the best plugins. You will probably want to look around for
posts by other programmers
and see what they are using. Vim is a well established and highly customizable editor, and as such, many
quality plugins have been developed over its lifetime. When you search online you will find that the same
plugins are mentioned time and time again.

Installing plugins is done in 1 of 3 ways.

copy a .vim script into ~/.vim/plugins

unzip a zip file into ~/.vim

open a vimball script (.vba) in vim and source it (vim foo.vba then :source %)

The website or help file for each plugin usually indicates which install mechanism to use, and each of
the 3 ways are fairly easy.

As I spent my first few weeks with Vim I went on a little bit of a plugin spending spree, trying out lots
of scripts I thought might be useful to me, but in practice only a handful ended up getting repeated
use. I expect that list to change as I use Vim more and more for real programming and learn what is important
and what is irrelevant.

The 3 plugins I find myself using the most are commandt, bufexplorer and ack:

After spending many years using the file open dialog in Visual Studio or UltraEdit, I can’t help be
a little jealous of TextMate users who get to open files using fuzzy matching with Command-T. So now
that I am switching to Vim I finally get to open my files efficiently as well with this plugin, that
I have mapped to <C-t>.

Note that while the install of this plugin is a simple vimball, it has some requirements
that are tricky to get correct. First, you need a version of Vim that is built with Ruby support
enabled, second you need to have the same version of ruby available that was used to build vim (1.8.7),
and finally you need a C compiler to build the ruby extension used to make this plugin fast and efficient.

Here are the steps I took to install…

Check to see that my version of vim (debian vim-gnome) has ruby enabled:

vim --version | grep ruby
... +ruby ...
... -lruby1.8 ...

I work with ruby on my projects, but most of them have moved on to ruby1.9, so I need to install
ruby1.8 and setup debian alternatives to be able to switch between the 2 versions.

As soon as you start opening multiple files you have to deal with managing those buffers, and this plugin makes life
much easier than using raw Vim commands. Install the plugin by unzipping into your ~/.vim directory, then map an
appropriate key, e.g:

map <C-b> :BufExplorer<CR>

… and now you can use that key to quickly list all your open buffers and switch between them.
Easy and useful. Nice!

The absolute, most important tool in a programmers arsenal is the ability to efficiently find what
you need amongst hundreds of files. We talk about grep as the
tool that does that, but ack is a better grep designed for programmers,
it has some knowledge about the types of files and knows to ignore things like .svn folders and
temporary files.

The ack.vim plugin gives you an :Ack command
within Vim that will run ack in the shell then present the results in a quickfix pane that can be
used to quickly navigate to each line that contains your match.

ZoomWin - zoom in and out of current window pane (e.g. toggle splits on and off)

And here are a few that I thought would be great, but I just never ended up using:

MRU - I thought having quick access to most recent files would be critical, but I ended up using either a saved session or a quick command-t fuzzy find and never really used the MRU list.

Conque Shell - I really, really wanted to use Vim split windows and have a file in one and a shell in the other, but it doesn’t feel natural using a vim buffer to manage a shell and I ended up not using this. Instead I end up using vim inside tmux (or multiple putty windows).

Finally, here are some that I want to use, but have not yet got around to trying: