1

I use different colorschemes depending on the color of my xterm. Some of them (in particular torte) set the background color to black, others leave the background color the same as the xterm color. The colorscheme is specified as an environment variable for each xterm.

I also use the lines

set hlsearch
hi Search ctermfg=white  ctermbg=black cterm=NONE
hi IncSearch ctermfg=Black  ctermbg=lightyellow cterm=bold,underline,reverse

which highlight with a black background my search term. Obviously this doesn't help me when the background is already black. So I'd like to condition the above lines (specifically ctermfg) on the value of the environment variable which specifies my color scheme. (Specifically, whether this value is torte) Should be easy but I'm hopeless with vim syntax. Thanks!

2

My advice to you is make your own color schemes that incorporate your versions of Search and IncSearch. But you if you really don't want to do that you could probably do the following:

if g:colors_name == "torte"
...
else
...
endif

Please note that this is not guarenteed to work as this is only a standard and not a sure fire way to see your color scheme.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.