Cokes
Cokes

Reputation: 4093

Highlight during search not working in vim

I have in my ~/.vimrc:

set hlsearch

Indeed, when I start searching for a word such as "dude"

/dude

the word "dude" highlights nicely as I start typing "dude" after the slash. However, after I hit enter to signify that I am finished typing in my search, the highlighting goes away, and then I cannot see in my script where the word "dude" occurs. When I hit "n" for next, it takes me to the next occurrence of "dude", but again it is not highlighted.

I am on Mac OS in the terminal using vim.

:hi Search

returns: xxx term=reverse ctermbg=11 guibg=Yellow

What can I do to keep highlighting when I search for the word of interest in vim?

Upvotes: 3

Views: 2028

Answers (2)

Cokes
Cokes

Reputation: 4093

I needed:

hi Search term=reverse cterm=NONE ctermfg=grey ctermbg=blue

At first I had cterm=xterm and neglected term=reverse, which somehow led to the behavior above...

Upvotes: 3

Ingo Karkat
Ingo Karkat

Reputation: 172570

It seems like the highlighting definitions in your Search group aren't recognized / visible, but those of IncSearch are. Choose a different colorscheme, fix / override the Search definition, or as a quick "don't make me think" fix, mirror the latter to the former via:

:hi clear Search
:hi link Search IncSearch

Upvotes: 1

Related Questions