Added n highlighting

This commit is contained in:
Veit Heller
2014-09-15 23:21:04 +02:00
parent 2c2530d46c
commit 98be3e30a2

20
vimrc
View File

@@ -176,3 +176,23 @@ vnoremap <leader>cu :<C-B><C-E>s/^\V<C-R>=escape(b:comment_leader,'\/')<CR>//e<C
highlight ColorColumn ctermbg=magenta highlight ColorColumn ctermbg=magenta
call matchadd('ColorColumn', '\%80v', 100) call matchadd('ColorColumn', '\%80v', 100)
nnoremap <silent> n n:call HLNext(0.4)<cr>
nnoremap <silent> N N:call HLNext(0.4)<cr>
highlight WhiteOnRed ctermbg=red ctermfg=white
function! HLNext(blinktime)
let [bufnum, lnum, col, off] = getpos('.')
let machlen = strlen(matchstr(strpart(getline('.'), col-1),@/))
let target_pat = '\c\%#'.@/
let blinks = 3
for n in range(1, blinks)
let red = matchadd('WhiteOnRed', target_pat, 101)
redraw
exec 'sleep ' . float2nr(a:blinktime / (2*blinks) * 1000) . 'm'
call matchdelete(red)
redraw
exec 'sleep ' . float2nr(a:blinktime / (2*blinks) * 1000) . 'm'
endfor
endfunction