Monday, February 20, 2012

Vundle to manage my VIM plugins.

To avoid getting too dependent on a VIM plugin that might not be available on the different machines I access, I've avoided having too many of them.  I mainly look for plugins that will make writing code faster since I do most of my development on just 2-3 machines.  Recently, a project required me to get back into Java programming.  Java projects are one of those that really seems to benefit from using some form of IDE especially for navigating through the code, but after trying Eclipse (which is pretty nice) I still felt that writing code is faster in VIM for me.

That lead me to Eclim which is an Eclipse and VIM plugin combo that allowed VIM to access Eclipse's functionality.  This is pretty cool as it allowed me to do most of my work in VIM and switch to Eclipse when I needed to.  While this solution works, I started getting the itch to see how VIM can handle some of the tasks I was depending on Eclipse for so I started looking at various VIM plugins which led me to research how to manage plug-ins in general.

Initially all the info I found talked about Pathogen which allowed each plug-in to be stored in its own directory and address the big problem of having all of your plugins clumped together in the .vim directories.  However, you still had to manually download and install each plugin.  Most users of Pathogen went the path of using Git to manage the plugins pulling each plugin from Git as a submodule.  I was about to give Pathogen a try when I came across Vundle.  Vundle take Pathogen and take it one step further by integrating the downloading and installation of your plugins.

Essentially, you install the Vundle plugin and then in your .vimrc list the plugins you want to use.  Start up VIM and do a ":BundleInstall" and it will download the plugins to their own directory and install/upgrade each one.  It's all very clean.

set nocompatiblefiletype offset rtp+=~/.vim/bundle/vundlecall vundle#rc()
Bundle 'gmarik/vundle'
Bundle "bufexplorer.zip"Bundle "snipMate"Bundle "SuperTab-continued."Bundle "taglist.vim"
Bundle "bufkill.vim"Bundle "Command-T"
 Having this at the top of your .vimrc and you can immediately see what kind plugins to use (remove one and Vundle will uninstall it for you as well).  If you share your .vimrc across multiple machine (i.e. through github) you don't have worry about keeping copies or download the plugins yourself since vundle handles all of that.

No comments:

Post a Comment