Better search highlighting
This commit is contained in:
parent
f9d8887aca
commit
5fd363e489
1 changed files with 16 additions and 0 deletions
16
.vimrc
16
.vimrc
|
@ -98,6 +98,10 @@ inoremap <Down> <NOP>
|
|||
vnoremap > >gv
|
||||
vnoremap < <gv
|
||||
|
||||
" Use better search highlighting
|
||||
nnoremap <silent> n n:call HLNext(0.4)<cr>
|
||||
nnoremap <silent> N N:call HLNext(0.4)<cr>
|
||||
|
||||
" Leaders (shortcuts)
|
||||
let mapleader = ","
|
||||
|
||||
|
@ -197,6 +201,18 @@ function! RenameFile()
|
|||
endif
|
||||
endfunction
|
||||
|
||||
" Blink current search item - from Damian Conway 'More Instantly Better Vim'
|
||||
function! HLNext (blinktime)
|
||||
let [bufnum, lnum, col, off] = getpos('.')
|
||||
let matchlen = strlen(matchstr(strpart(getline('.'),col-1),@/))
|
||||
let target_pat = '\c\%#'.@/
|
||||
let ring = matchadd('ErrorMsg', target_pat, 101)
|
||||
redraw
|
||||
exec 'sleep ' . float2nr(a:blinktime * 1000) . 'm'
|
||||
call matchdelete(ring)
|
||||
redraw
|
||||
endfunction
|
||||
|
||||
" Set special case colors
|
||||
function! SetColors()
|
||||
highlight CursorLine cterm=NONE ctermbg=234
|
||||
|
|
Loading…
Reference in a new issue