Vim 101: Using Vundle and Pathogen in Windows

Last week we looked at getting Vim running in Windows. Although there are more platform-specific issues that I could discuss, I thought looking at using Vundle and Pathogen in Windows would be useful.

If you haven't used Vundle or Pathogen before you might be wondering what the advantages are. I like them because they make it easier to quickly try out a plugin, and to install my favourite plugins on a new machine or server. They make it easier to keep multiple machines in sync -- this isn't useful if you mostly only use one machine, but if you're switching between a work desktop and your home computer or laptop then it saves time.

Vundle

The Vundle for Windows documentation explains how to get Vundle running. Basically, to make the Windows environment look more like what Vundle expects, the Git and Curl binaries must be installed. Once that's done, steps two and three from the Vundle Quick start documentation should be followed, which will result in the creation of a _vimrc with the appropriate Vundle settings.

Vundle works by adding a Bundle function to Vim that allows Git repositories to be defined that contain the plugins you want to install. To install the defined plugins, type :BundleInstall from within Vim. Typing :BundleList will show all of the configured bundles -- for details on more commands type :help vundle.

Pathogen

Pathogen is slightly different to Vundle because it's purely aimed at making the 'runtimepath' easier to work with. Rather than extracting plugins and other add-ons into the folder structure Vim expects by default, files can be dumped unceremoniously into ~/.vim/bundle.

It's a little bit more spartan than Vundle, but does the job fairly well. Tim Pope's other Vim scripts are also well-received, and he updates Pathogen regularly despite its superficial simplicity.

To install it in Windows, you can use Git to check out the source from tpope / vim-pathogen, or you could manually download the source from GitHub. Once you've got the source, you'll need to extract it into a folder called vimfiles in your home directory -- create the folder if it doesn't exist, then copy Pathogen's autoload folder into it.

Once you've done that, put the following line in your _vimrc:

call pathogen#infect()

Now Pathogen is ready for plugins.

Create another directory inside vimfiles called bundle. Next we need a plugin to actually test out -- how about NERD Tree? Download the zip file from GitHub, and extract the folder into vimfiles\bundle\ -- mine was vimfiles\bundle\scrooloose-nerdtree-bf79e22\. Now, load gVim and type :NERDTree and you should see something like this:

NERDTree in Windows

Conclusion

Whether you prefer Vundle or Pathogen, it's great that they both work without much hassle in Windows. If you're having trouble maintaining a messy vimfiles folder, then they're currently the best options available.

blog comments powered by Disqus