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

I've got a .vimrc and .vim folder I've been tweaking for a while, but on my machine at a new job, I've just installed ryanb's dotfiles (which contains config files for vim, git, and more). There are things I like in each config, so ultimately I want to combine them into a new personal config. Meanwhile, I'd like to be able to switch back and forth.

Is there an easy command for this in vim - "use the following .vimrc and .vim directory" - or would it be more straightforward to swap out the files themselves when I want to switch?

share|improve this question
up vote 6 down vote accepted

The -u option will allow you to specify a configuration file other than ~/.vimrc, but there is no option to specify an alternative to the ~/.vim directory. However, you can have Vim use a different directory by modifying the 'runtimepath' ('rtp') option in each of your configuration files. For example, you could use this command

let &rtp = substitute(&rtp, '\.vim\>', '.vim1', 'g')

in one of your configuration files to tell Vim to use the ~/.vim1 directory rather than the ~/.vim directory.

share|improve this answer
I'm guessing I can use this to keep everything in Dropbox :) – Michael Caron May 11 '11 at 15:03
@Michael Caron - you can keep your .vimrc and .vim anywhere you like, as long as you have symlinks in your home folder to wherever you put them. Personally, I use this trick to keep all my configs in a .dotfiles folder, which I can sync to Github. – Nathan Long Oct 7 '11 at 20:15

-u tells vim to use an alternate vimrc file.

share|improve this answer
I recently learned that vim -u "NONE" opens vanilla vim, with no configuration. That can be useful if you've got a complex configuration and want to know whether some behavior is native to Vim or not. (This also works for MacVim - I haven't tried Gvim on Linux.) – Nathan Long Oct 7 '11 at 20:13

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.