开发者

Setting Vim Options with Variables

开发者 https://www.devze.com 2023-02-27 04:56 出处:网络
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

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

0

精彩评论

暂无评论...
验证码 换一张
取 消