ASCII Thoughts

Managing Vim Plugins with Vundle

If you are a heavy user of vim, chances are that over time you added a bunch of plugins, syntax files and other goodies to your vim configuration. This makes your editing experience smoother, but if you installed all these scripts manually, maintaining them can be a pain. Keeping up-to-date with the latest versions, or simply removing one you don't use anymore becomes difficult as files from the different scripts get mixed up in your .vim directory.

Vimballs and pathogen can both ease the process, but you still have to download the scripts manually, and take care of all the updates.

Vundle

Vundle is basically a package manager for vim plugins. It will search, install, update and delete plugins for your while maintaining a nice directory structure. To install it:

git clone git://github.com/gmarik/vundle.git ~/.vim/bundle/vundle

Then, update your .vimrc with the following lines:

set rtp+=~/.vim/bundle/vundle/
call vundle#rc()

You're good to go.

Installing a plugin

Let's say that you are want to install Align. You can do a search for it in vim:

:BundleSearch align

And you will be greeted by a new window listing all the search results:

" Keymap: i - Install bundle; c - Cleanup; ...
" Search results for: align
Bundle 'right_align'
Bundle 'align--Ahmad'
Bundle 'Easy-alignment-to-column'
Bundle 'Align.vim'
Bundle 'AutoAlign'
Bundle 'feralalign.vim'
Bundle 'Align'
Bundle 'Lineup--A-simple-text-aligner'

Press i to install a plugin, and then copy the relevant line to your .vimrc to have it loaded automatically when you launch vim:

" Initialize Vundle
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()

" My plugins
Bundle 'Align'

Sometimes, the result of the search isn't very useful and you won't be sure which plugin to install. I find that an easier way is to go directly to the list of scripts where you will find a short description and links to the plugins' pages.

Other commands

Updating all your plugins:

:BundleInstall!

Removing unused plugins:

:BundleClean

Where to find plugins?

You can look on vim.org for the list of all plugins, sorted by ratings or downloads. This will give you an idea of what most people are using: chances are some of them will be useful to you too.

Beginners might also want to look at the janus distribution, which makes starting with vim easier. More advanced users will enjoy the Thoughtbot dotfiles.

That's it for today. Hope you enjoyed it.

Until next time, Cheers!