Is it possible to not trigger my normal search highlighting when using search as a movement?
Posted
by
Nathan Long
on Super User
See other posts from Super User
or by Nathan Long
Published on 2011-02-10T14:29:58Z
Indexed on
2011/02/10
15:27 UTC
Read the original article
Hit count: 245
vim
When I do a search in vim, I like to have my results highlighted and super-visible, so I give them a bright yellow background and a black foreground in my .vimrc
.
" When highlighting search terms, make sure text is contrasting colors
:highlight Search guibg=yellow guifg=black
(This is for GUI versions of vim, like MacVim or Gvim; for command-line, you'd use ctermbg
and ctermfg
.)
But I sometimes use search as a movement, as in c/\foo
- "change from the cursor to the next occurrence of foo
."
In that case, I don't want all the occurrences of foo
to be highlighted.
Can I turn off highlighting in cases where search is used as a movement?
© Super User or respective owner