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?

3 Answers 3


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')
  • 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 stackoverflow.pastebin.com/4jVT1wsR ). I think I'm close, however. Jun 9, 2010 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. Jun 14, 2010 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. Jan 16, 2012 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.


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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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