I had to notice that this doesn't work:
let test=128 highlight Normal ctermbg=test
Is it possible to use variables in colorschemes?
Vi and Vim Stack Exchange is a question and answer site for people using the vi and Vim families of text editors. It only takes a minute to sign up.Sign up to join this community
Vimscript is evaluated exactly like the Ex commands typed in the
: command-line. There were no variables in
ex, so there's no way to specify them. When typing a command interactively, you'd probably use
<C-R>= to insert variable contents:
... but in a script,
:execute must be used. All the literal parts of the Ex command must be quoted (single or double quotes), and then concatenated with the variables:
execute 'sleep' timetowait . 'm'