I am trying to write a function in vimrc that behaves differently based on colorscheme but I can't work out how to test the value of :colorscheme in vimrc. I'm trying to do this:
if (&colorscheme == 'myscheme') ...something... else ...something else... endif
But colorscheme is isn't a variable so the usual way of checking &variable doesn't work. Thanks for heping...
Last edited by starfry (2013-01-19 20:12:21)
The help page says (correctly) that "color[scheme]" outputs the name of the current color scheme. That should work in the conditional - or if you want you can set it's output to a variable.
color schemes will set the variable “g:colors_name“. Thus:
if g:colors_name == 'myscheme' ... foo ... else ... bar ... endif
Thank you Vain, that is the answer I was looking for. "color[scheme]" does indeed output the name of the current color scheme but I cound not get it to work in the conditional. Using the g:colors_name variable works a treat. Very much appreciated