Skip to content

Instantly share code, notes, and snippets.

@pvinis
Created October 16, 2012 19:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pvinis/3901445 to your computer and use it in GitHub Desktop.
Save pvinis/3901445 to your computer and use it in GitHub Desktop.
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