Say my cursor is in the middle of the screen and I jumped with gg and then jumping back with C-o or maybe other jumping command (like using marks). What happens now is that line that have been in the centre of the screen would be at the bottom or at the start. I'd like it to be at the same screen position it was before jump.

  • 1
    Christian's answer is correct, however, I think using zz, zt, z-, etc after a jump can be a nice workaround which can be faster than using the views see :h scroll-cursor.
    – statox
    Commented Oct 13, 2017 at 14:24

1 Answer 1


you can use the winsaveview() and winrestview() functions, to correctly restore the last saved view. However, there is no easy way to have this done automatically restore a view after a jump or so. You would have to do some Vim Scripting to have this work for you.

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.