Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I use git to persist my ~/.vim directory. I'd like to store my vimrc file in this directory as well so that it will also live in the repository. How do I change the location where Vim searches for the vimrc file?

share|improve this question

2 Answers 2

up vote 9 down vote accepted

You don't. Symlink it instead.

mv ~/.vimrc ~/.vim
ln -s  ~/.vim/.vimrc ~/.vim

You cam do the symlink thing to sync your vimrc through Dropbox as well.

share|improve this answer
I think you meant mv ~/.vimrc ~/.vim and ln -s ~/.vim/.vimrc ~/.vimrc". That's what I do, too, as well as ln -s ~/Dropbox/vimfiles ~/.vim`. –  garyjohn Aug 25 '11 at 4:41
Fixed. Thats the last time I answer on a phone at midnight :P –  digitxp Aug 25 '11 at 13:08
For Windows you can use echo source ~/.vim/.vimrc > .vimrc instead, which works better than the actual symlink variant Windows uses. –  Daan Bakker Mar 6 '13 at 22:51

digitxp's answer is probably the better one, but you can tell Vim to look for your vimrc anywhere you like with the -u command-line option, and gvimrc with -U, e.g.:

vim -u ~/.vim/vimrc -U ~/.vim/gvimrc
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.