Setting Vim Options with Variables
I've a question that should be fairly simple, but I have yet to find a solution for. I'm editing my .vimrc and would like to set an option using results saved in a variable. For example, I would like to aggregate all my temporary files in ~/.vimetc. Here's what I would like to do,
let s:vimetc=$HOME.'/vimetc/'
set backupdir=s:vimetc.'backups/'
set directory=s:vimetc.'vimswap/'
se开发者_如何学编程t viewdir=s:vimetc.'vimswap/'
Of course, set doesn't resolve variables so I just end up with the literal |s:vimetc.'backups/'|, not at all what I would like. I tried using &s:vimetc with similar results. Does anyone know how to do this?
let &backupdir=s:vimetc.'backups/'
http://vimdoc.sourceforge.net/htmldoc/eval.html#:let-option
精彩评论