Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Like many of you, my custom Vim configuration is stored in my ~/.vimrc, with the plugins, colors, etc. stored under ~/.vim/plugins, ~/.vim/colors, etc.

I want to share a single Vim configuration among many servers. Some of these servers run Vim 7, some run the older Vim 6. Most Vim plugins are intended for Vim 7, but older versions still exist for those of us on older systems. See DirDiff for an example.

If I am on a system which runs Vim 6, how can I configure Vim to only use Vim 6-compatible plugins?

I was thinking about storing older plugins in a subdirectory like ~/.vim/plugins6/ and keep the Vim plugins in ~/.vim/plugins, but then how can I tell Vim6 to ignore ~/.vim/plugins and use ~/.vim/plugins6 instead?

share|improve this question
up vote 4 down vote accepted

In your .vimrc, you'll have to check vim version, and update your &runttimepath in consequence.


My mistake. Vim directories architecture is hard-coded. Instead, you should have a ~/.vim6 directory that has symlinks to all ´/.vim directories but plugin/ and after/plugin, and you should add the following in your .vimrc:

if version < 700
   let &rtp=substitute(&rtp, '\.vim', '&6', 'g')
share|improve this answer
Thanks. I tried this, but it seems that Vim is picking up the plugin in ~/.vim/plugin , not ~/.vim/plugin6 (See my code, and the results at ). I think I'm close, however. – Stefan Lasiewski Jun 9 '10 at 18:13
Your update works great. Thanks! I now have a .vim and a .vim6 directory, and update the Vim realtimepath (rtp) as appropriate. – Stefan Lasiewski Jun 14 '10 at 22:41
Checking v:version is more proper. version is left for legacy compatibility. Also note that for Vim 7.3, v:version == 703. – Paweł Gościcki Jan 16 '12 at 16:36

I would try to do it like this:

HOME=<customdir1> <vim binary version1>

HOME=<customdir2> <vim binary version2>

HOME is an environment variable here. For convenience you could wrap these calls into shell scripts.

This general approach often works.

share|improve this answer

You could have your vimrc check the vim version, then source all the plugins from a specific folder.

if &loadplugins
  if v:version >= 700
    runtime! plugin7/*.vim
    runtime! plugin7/**/*.vim
  elseif v:version >= 600
    runtime! plugin6/*.vim
    runtime! plugin6/**/*.vim
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.