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?

link|improve this question
feedback

2 Answers

up vote 8 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.

link|improve this answer
4  
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
feedback

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
link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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