I am trying to create a (git) repository for my vim files. Now, I am already struggling as to what directory I would store my files under. As far as I can see there is either %HOME% or %VIM%, right? Naturally, I feel more inclined to use %VIM%. So I go
set VIM=x:\path\to\repo cd %VIM% notepad vimrc to create a basic vimrc file in my repo. The vimrc also contains syntax enable. Now, when I start gvim and the startup process reaches the syntax enable line, it gives an error message:
Error detected while processing x:\path\to\repo\vimrc
line 86
E484: Can't open file x:\path\to\repo\syntax\syntax.vim
This seems to be because vim automatically sets $VIMRUNTIME to the value of $VIM if $VIM is set. This is of course not what I want, since I was happy with vim's default determining of $VIMRUNTIME at startup. Neither do I want to globally set %VIMRUNTIME% as I don't want to change it if I install a newer vim version.
So, what is the canonical way to keep my personal vim files in a repository?
set VIM=x:/path/to/repo. I don't have a Windows machine to test, but all the docs use forwards slashes.VIMenvironment variable.$VIMand$VIMRUNTIMEare automatically set by Vim when it runs. You should prefer to use$HOMEsince that is your personal config area where as$VIMis a system directory, which you may not even have write access to.