8
1
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?
8
1
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?
11
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.
5
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
1
Vim 7.4 also sources ~/.vim/vimrc
by default. help vimrc
says:
Unix $HOME/.vimrc or $HOME/.vim/vimrc
But my current favorite solution for backing up files anywhere is https://github.com/technicalpickles/homesick which concentrates all config files in a single place and handles symlink management for you.
6I think you meant
mv ~/.vimrc ~/.vim
andln -s ~/.vim/.vimrc ~/.vimrc". That's what I do, too, as well as
ln -s ~/Dropbox/vimfiles ~/.vim`. – garyjohn – 2011-08-25T04:41:18.487Fixed. Thats the last time I answer on a phone at midnight :P – digitxp – 2011-08-25T13:08:22.917
For Windows you can use
echo source ~/.vim/.vimrc > .vimrc
instead, which works better than the actual symlink variant Windows uses. – Daan Bakker – 2013-03-06T22:51:56.653