By default when you scroll down to the end of a displayed buffer in a vim window, you can scroll until the last file line is on first line of the vim display area. All other lines of the display area are marked with "~" characters. Is there a configuration to stop scrolling when the last file line is at the bottom of the vim window?
Edit: To be more precise this behavior only apply to mouse wheel scroll or PgDown key navigation that fill the screen with those non-existant line marks. I the cursor is moved line by line using the down arrow key, it stops correctly at the last file line.
Simply zb to align the current line to the bottom of the window.
E.g. Gzb
Not surpisingly there is a family of related panning motions:
For completeness:
Also, have a look at scrolloff
I use
:set scrolloff=2
to always keep a minimum buffer of 2 lines before or after the current cursor line. This makes these panning motions almost magical. I spend all day browsing code bases using nothing but
I don't think so. But even if there were, how would you want it to behave if there were less lines in your file than on your screen? You'd have to display those non-existent lines somehow.
You'd have to have some way to tell vim to display those lines if the top of the file is in view, but not allow them to display if the top isn't in view.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With