I have an adapted version of Damian Conway's Die Blinknmatchen in my ~/.vimrc that highlight-flashes search matches as I step through them with n / N: 'hlsearch' makes it hard to tell which is the *current* match, so we do some trickery to highlight that one in a special way (flashing for 0.4 seconds). function to flash the current match a number of timesfunction! HLNext (blink)    let [bufnum, lnum, col, off] = getpos('.')    let matchlen = strlen(matchstr(strpart(getline('.'),col-1),@/))    let target_pat = '\c\%#\%('.@/.'\)'    let i = 1    while i < a:blink        exec 'sleep 50m'        let ring = matchadd('Comment', target_pat, 101)        redraw        exec 'sleep 50m'        call matchdelete(ring)        redraw        let i += 1    endwhileendfunction Rewire n and N to step-and-call-functionnnoremap <silent> n   n:call HLNext(5)<cr>nnoremap <silent> N   N:call HLNext(5)<cr>This works nice, but has one drawback -- skipping through many matches takes much longer, as the next match is not highlighted until the flashing of the current one has finished.Is there a way to have the function interrupt the highlighting / flashing if n / N is pressed again while the function still runs?I am afraid my knowledge of Vim programming is very limited (to copy & paste, mostly), so I hope to find the necessary brainpower among you lot.
Interrupting (blink-highlighting) function if mapping is invoked again
vimscript;vimrc