Skip to content
Create a gist now

Instantly share code, notes, and snippets.

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'
endif
endfunction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.