Using pathogen for vim configuration management

In a previous post I talked about switching to Vim and how I was using Janus to get a good foundational set of plugins to work with, and make starting with vim less daunting. As I’ve gotten more comfortable with vim, I wanted a simpler way to manage my vim config. I wasn’t using the framework-y bits of Janus, and it included a pile of plugins I’ll simply never use. After hearing great things about pathogen I decided to give it a spin.

Updating to use pathogen

I started off by making a new git repo to hold my config. I’m lazy and want an easy way to keep all my vim installs in sync, and git is great for that. I started off by copying my existing vimrc and gvimrc files. To make pathogen work I had to add two lines to my vimrc:

Show Plain Text
  1. " Include pathogen
  2. call pathogen#infect()
  3. call pathogen#helptags()

This sets up the pathogen magic. Then, I created the directories suggested by pathogen. I went through the very long list of plugins that Janus ships with and picked out the ones I actually use. Of those, many are hosted on github making submodules a perfect fit. For every plugin on github I did something similar to:

Show Plain Text
  1. git submodule add git:// bundle/fugitive

I use a few plugins that are not hosted on github as well. For these I just added the plugin files directly into my repo following the pathogen conventions.

Making it easy to install

Once all my plugins were wired together, I had a git repo with all the plugins I wanted, and my vimrc files. I wanted to make setting up a new vim install really simple. I wrote a simple make script that allows me to run all the install steps in one command. This makes the whole process take 2 steps, which was acceptable for me:

Show Plain Text
  1. git clone ~/.vim
  2. cd .vim && make install

You could substitue fabric or rake for make if you wanted. I prefer make as its almost always results in a smaller script than using anything else. I’ve found pathogen to be a great tool for managing a vim setup. It makes a great next step after you’ve gotten comfortable with using a prebuilt package like Janus. A big thanks to Tim Pope, for making it, and all other other fantastic plugins he’s written. If anyone is interested, I’ve made my setup available on github .


You should separate between the installed plugins, and active plugins. Do so by having a directory called bundle-available in your .vim/ and the current bundle/ directory you already have. You would then download plugins to bundle-available, and ‘activate’ them by creating a symlink from bundle/ to their bundle-available/ location. You can do this on your current setup by:

$ cd ~/.vim
$ mkdir bundle-available
$ cd bundle/
$ mv * ../bundle-available
$ find ../bundle-available/* -type d -exec ln -s {} \;

And update the GIT submodule references we just moved:

$ cd ~/.vim/.git/config
$ sed ‘s/bundle\//bundle-available\//’ -i config

As an example, see

This way, you can easily enable/disable plugins by just adding/removing the symlinks from the bundle/ to your bundle-available/ directory. This plays particularly useful when you share your git setup across many boxes, and may wish to disable some plugins on specific boxes easily.

Mariano Iglesias on 11/7/11

So Mark, I know I recommended pathogen in a comment on your last vim post. Maybe you tried it out subsequently?

Thing is; I found something even better. It kinda sucks, because just after setting everything up nicely with pathogen, I had to throw that work away.

BUT, it’s worth it, because Vundle is even better. Vundle is pathogen on steroids. It does mostly the same thing, but you don’t need to manage your plugins manually any more! You pull in and enable plugins in literally 1 LINE OF CODE. This is because Vundle uses git to automatically download, update and enable vim plugins. No need for manually adding submodules.

Find it here:

You can see me using it here:

Once you’ve setup vundle, all that’s needed is adding `Bundle ‘github path/vimscripts name/full git url’` to your .vimrc and then running `:BundleInstall` afterwards. That’s it!

I’ve gitignored my bundle directory (apart from vundle) subsequently. Just run the with vundle and your .vimrc in place, you just run the above command and everything will sync up in a new installation. Magicness!

Matt Iversen on 11/14/11

Mariano: That’s a great idea, I’ll have to update my repo when I get a chance.

Matt: Vundle looks neat, I’ll take a look when I get around to levelling up my vim fu again :)

mark story on 11/14/11

You can use the recommendations from Steve Francia related with Vim, very useful.
spf13-vim : Steve Francia’s Vim Distribution

Ultimate Vim Config

The perfect .vimrc vim config file

Regards and best wishes,
Marcos Luis Ortíz Valmaseda Linux Infrastructure Engineer Linux User # 418229 Twitter: @marcosluis2186

Marcos Ortiz on 11/22/11

Have your say: