onehalf icon indicating copy to clipboard operation
onehalf copied to clipboard

Search and IncSearch have same highlight colors in vim

Open alexanderjeurissen opened this issue 7 years ago • 3 comments

doing an incremental search for a string or having search highlighting on and doing a search and replace in vim is really cumbersome due to current highlighting colors being used.

when you invoke search in vim all matches for the search pattern are highlighted, then the currently active match is usually highlighted in a different color. In OneHalf however this is not the case: screen shot 2017-01-18 at 21 13 31 screen shot 2017-01-18 at 21 13 21

This results in the following behaviour: screen shot 2017-01-18 at 21 20 39 here we can't determine what highlighted instance would be replaced if I press yes.

The next screenshot shows what the behaviour is if IncSearch has a different highlighting then default Search: screen shot 2017-01-18 at 21 29 10

In this case I simply hijack the highlighting groups that are defined in the onehalf colorscheme file by linking Search to Pmenu and IncSearch to PMenuSel. like this:

    hi! link Search PMenu
    hi! link IncSearch PMenuSel

as you can see the current active item is highlighted with a blue background and the others are highlighted with gray.

This is just a hack in my own vim configuration file however, I'm not sure what colors we want to use here. Just putting this out to see how we can fix this.

alexanderjeurissen avatar Jan 18 '17 20:01 alexanderjeurissen

Indeed fixing this issue is just a matter of changing two lines for Search and IncSearch. As for the colors I originally wanted to keep the yellow as they pop more on the screen.

From the top of my head maybe we can try

  • white/blue for dark and black/blue for light
  • yellow/red
  • yellow/blue
  • ??

Chrome uses yellow and orange for search highlighting so maybe yellow/red will be a good combination?

sonph avatar Jan 19 '17 19:01 sonph

To test the colors in onehalfdark.vim and onehalflight.vim just replace these lines

call s:h("IncSearch", s:bg, s:yellow, "")
call s:h("Search", s:bg, s:yellow, "")

with

call s:h("IncSearch", s:bg, s:red, "")
call s:h("Search", s:bg, s:yellow, "")

sonph avatar Jan 19 '17 19:01 sonph

Yellow/red sounds good, even if change our mind later, it's better to be functional for the time being.

SevereOverfl0w avatar Sep 11 '19 07:09 SevereOverfl0w