Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Right now, all of my search results in vim are highlighted in a bright (i.e. unreadable) yellow. I was wondering if there was a way to set the highlighting for search results to underline instead of highlight. I did some searching online and it seems possible, but the vim documentation is so obfuscated that I can't make out the syntax for this.

share|improve this question
up vote 7 down vote accepted

You need to modify the highlighting for the 'Search' syntax element. You can do that with a command like this:

:highlight Search guibg=black guifg=yellow gui=underline

That command will set the text color (i.e, foreground) of the found search words to yellow (againt black background) and will underline them. The command above alters only the highlighting for the gui, which means in gvim. Altering in terminal, I think would be this:

:highlight Search ctermbg=black ctermfg=yellow term=underline

share|improve this answer
This command set the bg and fg colors successfully. I presume it also set the underline flag, but it seems like my terminal can't show underline. However, bg = black and fg = yellow is much better, thanks! – Kevin Dec 22 '09 at 21:03
@Kevin: It may just be that I gave you the wrong info re: underline. 'cterm' stands for "color terminal" and 'term' for "normal terminal". You're definitely using a cterm. So you might try this for underline: highlight Search ctermbg=black ctermfg=yellow cterm=underline – Herbert Sitz Dec 22 '09 at 23:03
@Herbert That did it, thanks again! – Kevin Dec 23 '09 at 16:58

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.