In my .vimrc, I have the following variable defined:
let $VIMFILES = "~/.vim"
Further in my .vimrc, I attempt to set the
backupdir option like so:
set backupdir=$VIMFILES/backup " `set backupdir?` will return: backupdir=~/.vim/backup
However, it does not work. Attempting to
:w a file will fail and return the following:
"foo" E510: Can't make backup file (add ! to override)
Strangely enough, setting
backupdir using the following method works just fine...
exec "set backupdir=" . $VIMFILES . "/backup" " Like the first method, `set backupdir?` will " also return: backupdir=~/.vim/backup
Can anyone shed light as to why the first method fails and the second method works, despite
backupdir having the desired value in both cases? Am I using any improper techniques, and if so, what should I use instead?