public
Created

recenter vim search

  • Download Gist
gistfile1.txt
1 2 3 4 5 6 7 8
nnoremap n n:call Recenter(15)<CR>
nnoremap N N:call Recenter(15)<CR>
 
function! Recenter(tolerance)
if (abs(winline()-winheight(0)/2)>a:tolerance)
exe 'norm! zz'
endif
endfunction

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.