if possible. The
behavior of 'scrollbind' can be modified by the 'scrollopt' option.
When using the scrollbars or the mouse wheel, the binding only happens when
scrolling the window with focus (where the cursor is). You can use this to
avoid scroll-binding for a moment without resetting options.
When a window also has the 'diff' option set, the scroll-binding uses the
differences between the two buffers to synchronize the position precisely.
Otherwise the following method is used.
*scrollbind-relative*
Each 'scrollbind' window keeps track of its "relative offset", which can be
thought of as the difference between the current window's vertical scroll
position and the other window's vertical scroll position. When one of the
'scrollbind' windows is asked to vertically scroll past the beginning or end
limit of its text, the window no longer scrolls, but remembers how far past
the limit it wishes to be. The window keeps this information so that it can
maintain the same relative offset, regardless of its being asked to scroll
past its buffer's limits.
However, if a 'scrollbind' window that has a relative offset that is past its
buffer's limits is given the cursor focus, the other 'scrollbind' windows must
jump to a location where the current window's relative offset is valid. This
behavior can be changed by clearing the "jump" flag from the 'scrollopt'
option.
*syncbind* *:syncbind* *:sync*
:syncbind Force all 'scrollbind' windows to have the same
relative offset. I.e., when any of the 'scrollbind'
windows is scrolled to the top of its buffer, all of
the 'scrollbind' windows will also be at the top of
their buffers.
*scrollbind-quickadj*
The 'scrollbind' flag is meaningful when using keyboard commands to vertically
scroll a window, and is also meaningful when using the vertical scrollbar or
the mouse wheel in the window which has the cursor focus. However, when using
the vertical scrollbar or the mouse wheel in a window which doesn't have the
cursor focus, 'scrollbind' is ignored.
This allows quick adjustment of the relative offset of 'scrollbind' windows.
==============================================================================
6. Scrolling with a mouse wheel *scroll-mouse-wheel*
When your mouse has a scroll wheel, it should work with Nvim in the GUI and
any terminal that has mouse support. By default only vertical scroll wheels
are supported, but some GUIs also support horizontal scroll wheels.
Note that horizontal scrolling only works if 'nowrap' is set. Also, unless
the "h" flag in 'guioptions' is set, the cursor moves to the longest visible
line if the cursor line is about to be scrolled off the screen (similarly to
how the horizontal scrollbar works).
You can control the number of lines / columns to scroll by using the
'mousescroll' option. You can also modify the default behavior by mapping
the keys. For example, to scroll a page at a time in normal mode: >
:map <ScrollWheelUp> <C-B>
:map <ScrollWheelDown> <C-F>
Scroll keys can also be combined with modifiers such as Shift, Ctrl, and Alt.
When scrolling with a mouse, the window currently under the cursor is
scrolled. This allows you to scroll inactive windows. Note that when scroll
keys are remapped to keyboard keys, the active window is affected regardless
of the current cursor position.
vim:tw=78:ts=8:noet:ft=help:norl: