tags:

views:

143

answers:

2

After I make a jump to anywhere in the world, whether in the current file or a different file, is it possible to make vim automatically run zz (re-center on current line)?

I want this after things like search, ctrl-o and ctrl-i ... and pretty much any movement other than hjkl.

Thanks.

+4  A: 

Voila:

" Center screen on next/previous selection.
nnoremap n nzz
nnoremap N Nzz
" Last and next jump should center too.
nnoremap <C-o> <C-o>zz
nnoremap <C-i> <C-i>zz
Mosh
+2  A: 

Not an answer but a good tip, I like set scrolloff=7

szilveszter
+1 this would be great if it only worked on search (otherwise too annoying).
Peter