Checking for Python version and Vim version in your .vimrc

Recently I’ve had to adjust a bunch of my dotfiles to support some old (Centos 5) systems which means that I am using a Vim that has Python 2.4 build in… needless to say, it breaks some of my dotfiles 😉

So here’s some tips on patching Vim version issues.

First, checking if you have Python in your Vim and which version you are using. It returns a version similar to how Vim does it with it’s version. So 204 is the result for Python 2.4, 207 for Python 2.7 and so on.

Now we can make plugins/bundles dependend on versions:

And checking for the Vim version to see if features are available:

That’s it, the examples can be found in my Vim config:

Bookmark and Share


About Rick van Hattem

Rick van Hattem is a Dutch Internet entrepreneur and co-founder of
No comments yet.

Leave a Reply