1

Having hlsearch enabled, if I use something like :%s/search term/replacement term/gc vim will highlight all occurrences of the search term by using black foreground on yellow background, but for the currently selected one it uses black foreground on white background, which is hard to spot due to the syntax highlighting pattern for latex files already using this for something else. How would I change the background colour of the currently selected result to, say, pink?

1 Answer 1

2

You can change that using:

:hi IncSearch ctermbg=Red

The following colors should be available:

Black
DarkBlue
DarkGreen
DarkCyan
DarkRed
DarkMagenta
Brown, DarkYellow
LightGray, LightGrey, Gray, Grey
DarkGray, DarkGrey
Blue, LightBlue
Green, LightGreen
Cyan, LightCyan
Red, LightRed
Magenta, LightMagenta
Yellow, LightYellow
White

Other options you might be interested in are:

:hi IncSearch ctermbg=<color name> ctermfg=<color name>
:hi Search ctermbg=<color name> ctermfg=<color name>

See :h hi for the complete help on these options.

1
  • That's surprising. Indeed the help says IncSearch 'incsearch' highlighting; also used for the text replaced with ":s///c". Curiously what this does is that it changes the foreground colour of the selection to red, the background is still in white. Anyway, it does make it easy to spot the position.
    – muk.li
    May 19, 2015 at 9:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .