2

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 colorscheme. (specifically, whether this value is torte) Should be easy but I'm hopeless with Vim syntax.

2 Answers 2

3

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.

0
0

I found in syntax.txt that you could use the lines:

augroup your_autocmdgroup_name
  autocmd!
  autocmd Colorscheme torte
              \ | hi Search ctermfg=white ctermbg=black cterm=NONE
              \ | hi IncSearch ctermfg=Black  ctermbg=lightyellow cterm=bold,underline,reverse
augroup END

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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