I really like not having my cursor at the bottom part of the screen. Using :set scrolloff=20 does help when scrolling down a file, but it doesn't work when I reach the bottom (unless I zz).

Another problem (and the main question) is how to get vim to show the virtual space when opening a file? I have it setup to set the cursor at the last line where I was editing, and if that line is at the end of the file, it will open at the bottom.

1 Answer 1



au BufWinEnter * exe "normal zz"

But I guess there will be side effects. Test thoroughly.

One side effect: Assume you have 2 buffers loaded and Vim has only one ("full terminal") window. So one buffer is displayed. The other is hidden. If you switch to the hidden buffer, zz will be executed.

  • I feel kinda dumb now that I see this hehe. Thanks though! Any thoughts on possible side effects? So far I haven't run into any. Jan 12, 2019 at 0:25
  • @JakubArnold See update
    – Ralf
    Jan 12, 2019 at 8:49

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.