Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
recenter vim search
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'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment