diff --git a/internal/display/bufwindow.go b/internal/display/bufwindow.go index 369ea35ba3..d1228e9682 100644 --- a/internal/display/bufwindow.go +++ b/internal/display/bufwindow.go @@ -622,7 +622,8 @@ func (w *BufWindow) displayBuffer() { } if highlight { - if w.Buf.HighlightSearch && w.Buf.SearchMatch(bloc) { + isHighlightSearchMatch := w.Buf.HighlightSearch && w.Buf.SearchMatch(bloc) + if isHighlightSearchMatch { style = config.DefStyle.Reverse(true) if s, ok := config.Colorscheme["hlsearch"]; ok { style = s @@ -648,6 +649,12 @@ func (w *BufWindow) displayBuffer() { if s, ok := config.Colorscheme["selection"]; ok { style = s } + + if isHighlightSearchMatch { + if s, ok := config.Colorscheme["hlsearch.selection"]; ok { + style = s + } + } } if b.Settings["cursorline"].(bool) && w.active && !preservebg && diff --git a/runtime/help/colors.md b/runtime/help/colors.md index c085919a93..72c8e4b7f9 100644 --- a/runtime/help/colors.md +++ b/runtime/help/colors.md @@ -198,6 +198,7 @@ Here is a list of the colorscheme groups that you can use: * error-message (Color of error messages in the bottom line of the screen) * match-brace (Color of matching brackets when `matchbracestyle` is set to `highlight`) * hlsearch (Color of highlighted search results when `hlsearch` is enabled) +* hlsearch.selection (Color of the selection within the highlighted search results) * tab-error (Color of tab vs space errors when `hltaberrors` is enabled) * trailingws (Color of trailing whitespaces when `hltrailingws` is enabled)