Reputation: 10741
If using mouse wheel (or scrollbar) to scroll to the bottom of current buffer, then VIM allows to "scroll bellow" the bottom of the file. So that the last line appears at the top of current buffer. This brings much pain for me as for VIM newbie used to deal with other editors (especially MS VS).
Is there any way to disable "scrolling below the bottom"?
Upvotes: 3
Views: 1419
Reputation: 2938
If you don't mind that it moves the cursor, this works:
noremap <ScrollWheelUp> H5k
noremap <ScrollWheelDown> L5j
Upvotes: 0
Reputation: 1018
Adjust your scrolling offset with the following option.
:set scrolloff=NUMBER
Where NUMBER
is the number of lines around the cursor.
Excerpt from Vim's embedded help system:
'scrolloff' 'so' number (default 0)
global
{not in Vi}
Minimal number of screen lines to keep above and below the cursor.
This will make some context visible around where you are working. If
you set it to a very large value (999) the cursor line will always be
in the middle of the window (except at the start or end of the file or
when long lines wrap).
For scrolling horizontally see 'sidescrolloff'.
NOTE: This option is set to 0 when 'compatible' is set.
Upvotes: 1
Reputation: 6872
Well, if you type 'zb' in command mode, the current line goes to the bottom of the screen. That won't really prevent your problem, but it's at least a quick way to fix it when it happens.
Upvotes: 2