I use this snippet from Damian Conway's fantastic talk, More Instantly Better Vim (at 4m 59s). It causes the entire highlight to blink briefly when you leap between search results.
" Damian Conway's Die Blinkënmatchen: highlight matches
nnoremap <silent> n n:call HLNext(0.1)<cr>
nnoremap <silent> N N:call HLNext(0.1)<cr>
function! HLNext (blinktime)
let target_pat = '\c\%#'.@/
let ring = matchadd('ErrorMsg', target_pat, 101)
exec 'sleep ' . float2nr(a:blinktime * 1000) . 'm'
If you want the change in highlighting to be more persistent, you could tweak this to call
matchdelete at some other time (e.g. when the cursor moves).
I recently wrote this more advanced version in response to another question. It has the following changes::
- (Optionally) blinks repeatedly: Conway's original version just blinks once: on and then off,
- Allows you to interrupt the blinking by typing other commands (such as pressing
n again to jump to the next match.) This allows you to set a longer time
The vim-searchhi plugin provides the originally requested feature.