Frequently when using vim I will hit a case where I am looking at a function that is half off the bottom of the screen, and I would like to see the whole thing. ctrl-D will generally solve the problem visually, but it also moves my cursor. If I was already at the top of the function, I'd like to stay there, just see the whole thing. Is there a version of ctrl-D that acts more like ctrl-e, or even better, a command sequence that would center whatever function my cursor is currently in?

I'm using vim in at least three places: native GNOME Terminal on Fedora, native Terminal on OS X, and in both places occasionally over ssh.


1 Answer 1


You can use zt for keeping cursor at the top, zb for bottom and zz for middle; furthermore, you can find out more about these by using :h command

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.