20

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/'
set 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?

duckworthd
  • 14,679
  • 16
  • 53
  • 68

1 Answers1

32
let &backupdir=s:vimetc.'backups/'

http://vimdoc.sourceforge.net/htmldoc/eval.html#:let-option

Andy
  • 4,789
  • 23
  • 20