I store my .vimrc in my dotfiles repository located at ~/dotfiles/.vimrc, which I want to manage with Git using vim-fugitive. I have symlinks from my home directory to my dotfiles, i.e. ~/.vimrc -> ~/dotfiles/.vimrc.
I two problems with this:
- I can't do something like
:edit $MYVIMRC, change something and run:Gcommit, as fugitive does not follow symbolic links. Via the symlink my~/dotfiles/.vimrcopens when running the edit command, but fugitive commands are not available. - In my
.vimrcI define a number of autocommands that do use$MYVIMRC- some of them do no longer work, because they also have their troubles with the symlink.
Both problems could be easily fixed if I could change the value of $MYVIMRC, but I can't figure out how to do that. How can I change the value of $MYVIMRC?
I understand that I can also just ignore $MYVIMRC, i.e. replace it in all autocommands and not use it to edit my .vimrc, but this seems not like a good solution.
let $MYVIMRC="/home/username/dotfiles/.vimrc"in my.vimrcworks as long as I don't open the symlinks. I am surprised that I could just set it like a normal variable, given its unusual variable name. Embarassing... Thanks :-) – cbaumhardt May 26 '16 at 16:01