2017-03-21 09:08:19 -07:00
|
|
|
*scroll.txt* Nvim
|
2014-07-10 21:05:51 -07:00
|
|
|
|
|
|
|
|
|
|
|
VIM REFERENCE MANUAL by Bram Moolenaar
|
|
|
|
|
|
|
|
|
|
|
|
Scrolling *scrolling*
|
|
|
|
|
|
|
|
These commands move the contents of the window. If the cursor position is
|
|
|
|
moved off of the window, the cursor is moved onto the window (with
|
|
|
|
'scrolloff' screen lines around it). A page is the number of lines in the
|
|
|
|
window minus two. The mnemonics for these commands may be a bit confusing.
|
|
|
|
Remember that the commands refer to moving the window (the part of the buffer
|
|
|
|
that you see) upwards or downwards in the buffer. When the window moves
|
|
|
|
upwards in the buffer, the text in the window moves downwards on your screen.
|
|
|
|
|
|
|
|
See section |03.7| of the user manual for an introduction.
|
|
|
|
|
2017-10-20 17:33:58 -07:00
|
|
|
Type |gO| to see the table of contents.
|
2014-07-10 21:05:51 -07:00
|
|
|
|
|
|
|
==============================================================================
|
|
|
|
1. Scrolling downwards *scroll-down*
|
|
|
|
|
|
|
|
The following commands move the edit window (the part of the buffer that you
|
|
|
|
see) downwards (this means that more lines downwards in the text buffer can be
|
|
|
|
seen):
|
|
|
|
|
|
|
|
*CTRL-E*
|
|
|
|
CTRL-E Scroll window [count] lines downwards in the buffer.
|
2018-10-29 00:31:05 -07:00
|
|
|
The text moves upwards on the screen.
|
2014-07-10 21:05:51 -07:00
|
|
|
Mnemonic: Extra lines.
|
|
|
|
|
|
|
|
*CTRL-D*
|
|
|
|
CTRL-D Scroll window Downwards in the buffer. The number of
|
|
|
|
lines comes from the 'scroll' option (default: half a
|
|
|
|
screen). If [count] given, first set 'scroll' option
|
|
|
|
to [count]. The cursor is moved the same number of
|
|
|
|
lines down in the file (if possible; when lines wrap
|
|
|
|
and when hitting the end of the file there may be a
|
|
|
|
difference). When the cursor is on the last line of
|
|
|
|
the buffer nothing happens and a beep is produced.
|
|
|
|
See also 'startofline' option.
|
|
|
|
|
|
|
|
<S-Down> or *<S-Down>* *<kPageDown>*
|
|
|
|
<PageDown> or *<PageDown>* *CTRL-F*
|
2024-07-06 02:32:33 -07:00
|
|
|
<S-CR> or *<S-CR>* *<S-NL>*
|
2024-07-06 02:32:16 -07:00
|
|
|
<S-+> or *SHIFT-+* *<S-Plus>*
|
2014-07-10 21:05:51 -07:00
|
|
|
CTRL-F Scroll window [count] pages Forwards (downwards) in
|
|
|
|
the buffer. See also 'startofline' option.
|
|
|
|
When there is only one window the 'window' option
|
|
|
|
might be used.
|
|
|
|
|
|
|
|
*z+*
|
|
|
|
z+ Without [count]: Redraw with the line just below the
|
|
|
|
window at the top of the window. Put the cursor in
|
|
|
|
that line, at the first non-blank in the line.
|
|
|
|
With [count]: just like "z<CR>".
|
|
|
|
|
|
|
|
==============================================================================
|
|
|
|
2. Scrolling upwards *scroll-up*
|
|
|
|
|
|
|
|
The following commands move the edit window (the part of the buffer that you
|
|
|
|
see) upwards (this means that more lines upwards in the text buffer can be
|
|
|
|
seen):
|
|
|
|
|
|
|
|
*CTRL-Y*
|
|
|
|
CTRL-Y Scroll window [count] lines upwards in the buffer.
|
2018-10-29 00:31:05 -07:00
|
|
|
The text moves downwards on the screen.
|
2014-07-10 21:05:51 -07:00
|
|
|
Note: When using the MS-Windows key bindings CTRL-Y is
|
|
|
|
remapped to redo.
|
|
|
|
|
|
|
|
*CTRL-U*
|
|
|
|
CTRL-U Scroll window Upwards in the buffer. The number of
|
|
|
|
lines comes from the 'scroll' option (default: half a
|
|
|
|
screen). If [count] given, first set the 'scroll'
|
|
|
|
option to [count]. The cursor is moved the same
|
|
|
|
number of lines up in the file (if possible; when
|
|
|
|
lines wrap and when hitting the end of the file there
|
|
|
|
may be a difference). When the cursor is on the first
|
|
|
|
line of the buffer nothing happens and a beep is
|
|
|
|
produced. See also 'startofline' option.
|
|
|
|
|
|
|
|
<S-Up> or *<S-Up>* *<kPageUp>*
|
|
|
|
<PageUp> or *<PageUp>* *CTRL-B*
|
2024-07-06 02:32:16 -07:00
|
|
|
<S--> or *<S-Minus>* *SHIFT-MINUS*
|
2014-07-10 21:05:51 -07:00
|
|
|
CTRL-B Scroll window [count] pages Backwards (upwards) in the
|
|
|
|
buffer. See also 'startofline' option.
|
|
|
|
When there is only one window the 'window' option
|
|
|
|
might be used.
|
|
|
|
|
|
|
|
*z^*
|
|
|
|
z^ Without [count]: Redraw with the line just above the
|
|
|
|
window at the bottom of the window. Put the cursor in
|
|
|
|
that line, at the first non-blank in the line.
|
|
|
|
With [count]: First scroll the text to put the [count]
|
|
|
|
line at the bottom of the window, then redraw with the
|
|
|
|
line which is now at the top of the window at the
|
|
|
|
bottom of the window. Put the cursor in that line, at
|
|
|
|
the first non-blank in the line.
|
|
|
|
|
|
|
|
==============================================================================
|
|
|
|
3. Scrolling relative to cursor *scroll-cursor*
|
|
|
|
|
|
|
|
The following commands reposition the edit window (the part of the buffer that
|
2017-04-30 13:08:51 -07:00
|
|
|
you see) while keeping the cursor on the same line. Note that the 'scrolloff'
|
|
|
|
option may cause context lines to show above and below the cursor.
|
2014-07-10 21:05:51 -07:00
|
|
|
|
|
|
|
*z<CR>*
|
|
|
|
z<CR> Redraw, line [count] at top of window (default
|
|
|
|
cursor line). Put cursor at first non-blank in the
|
|
|
|
line.
|
|
|
|
|
|
|
|
*zt*
|
|
|
|
zt Like "z<CR>", but leave the cursor in the same
|
2015-04-29 17:04:26 -07:00
|
|
|
column.
|
2014-07-10 21:05:51 -07:00
|
|
|
|
|
|
|
*zN<CR>*
|
|
|
|
z{height}<CR> Redraw, make window {height} lines tall. This is
|
|
|
|
useful to make the number of lines small when screen
|
|
|
|
updating is very slow. Cannot make the height more
|
|
|
|
than the physical screen height.
|
|
|
|
|
|
|
|
*z.*
|
|
|
|
z. Redraw, line [count] at center of window (default
|
|
|
|
cursor line). Put cursor at first non-blank in the
|
|
|
|
line.
|
|
|
|
|
|
|
|
*zz*
|
|
|
|
zz Like "z.", but leave the cursor in the same column.
|
|
|
|
Careful: If caps-lock is on, this command becomes
|
2015-04-29 17:04:26 -07:00
|
|
|
"ZZ": write buffer and exit!
|
2014-07-10 21:05:51 -07:00
|
|
|
|
|
|
|
*z-*
|
|
|
|
z- Redraw, line [count] at bottom of window (default
|
|
|
|
cursor line). Put cursor at first non-blank in the
|
|
|
|
line.
|
|
|
|
|
|
|
|
*zb*
|
|
|
|
zb Like "z-", but leave the cursor in the same column.
|
|
|
|
|
|
|
|
==============================================================================
|
|
|
|
4. Scrolling horizontally *scroll-horizontal*
|
|
|
|
|
|
|
|
For the following four commands the cursor follows the screen. If the
|
|
|
|
character that the cursor is on is moved off the screen, the cursor is moved
|
|
|
|
to the closest character that is on the screen. The value of 'sidescroll' is
|
|
|
|
not used.
|
|
|
|
|
|
|
|
z<Right> or *zl* *z<Right>*
|
|
|
|
zl Move the view on the text [count] characters to the
|
|
|
|
right, thus scroll the text [count] characters to the
|
2015-04-29 17:04:26 -07:00
|
|
|
left. This only works when 'wrap' is off.
|
2014-07-10 21:05:51 -07:00
|
|
|
|
|
|
|
z<Left> or *zh* *z<Left>*
|
|
|
|
zh Move the view on the text [count] characters to the
|
|
|
|
left, thus scroll the text [count] characters to the
|
2015-04-29 17:04:26 -07:00
|
|
|
right. This only works when 'wrap' is off.
|
2014-07-10 21:05:51 -07:00
|
|
|
|
|
|
|
*zL*
|
|
|
|
zL Move the view on the text half a screenwidth to the
|
|
|
|
right, thus scroll the text half a screenwidth to the
|
2015-04-29 17:04:26 -07:00
|
|
|
left. This only works when 'wrap' is off.
|
2014-07-10 21:05:51 -07:00
|
|
|
|
|
|
|
*zH*
|
|
|
|
zH Move the view on the text half a screenwidth to the
|
|
|
|
left, thus scroll the text half a screenwidth to the
|
2015-04-29 17:04:26 -07:00
|
|
|
right. This only works when 'wrap' is off.
|
2014-07-10 21:05:51 -07:00
|
|
|
|
|
|
|
For the following two commands the cursor is not moved in the text, only the
|
|
|
|
text scrolls on the screen.
|
|
|
|
|
|
|
|
*zs*
|
|
|
|
zs Scroll the text horizontally to position the cursor
|
|
|
|
at the start (left side) of the screen. This only
|
2015-04-29 17:04:26 -07:00
|
|
|
works when 'wrap' is off.
|
2014-07-10 21:05:51 -07:00
|
|
|
|
|
|
|
*ze*
|
|
|
|
ze Scroll the text horizontally to position the cursor
|
|
|
|
at the end (right side) of the screen. This only
|
2015-04-29 17:04:26 -07:00
|
|
|
works when 'wrap' is off.
|
2014-07-10 21:05:51 -07:00
|
|
|
|
|
|
|
==============================================================================
|
|
|
|
5. Scrolling synchronously *scroll-binding*
|
|
|
|
|
|
|
|
Occasionally, it is desirable to bind two or more windows together such that
|
|
|
|
when one window is scrolled, the other windows are also scrolled. In Vim,
|
|
|
|
windows can be given this behavior by setting the (window-specific)
|
|
|
|
'scrollbind' option. When a window that has 'scrollbind' set is scrolled, all
|
|
|
|
other 'scrollbind' windows are scrolled the same amount, if possible. The
|
|
|
|
behavior of 'scrollbind' can be modified by the 'scrollopt' option.
|
|
|
|
|
2023-09-27 14:22:09 -07:00
|
|
|
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.
|
2014-07-10 21:05:51 -07:00
|
|
|
|
|
|
|
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*
|
2023-09-27 14:22:09 -07:00
|
|
|
Each 'scrollbind' window keeps track of its "relative offset", which can be
|
2014-07-10 21:05:51 -07:00
|
|
|
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
|
2017-11-05 21:05:54 -07:00
|
|
|
behavior can be changed by clearing the "jump" flag from the 'scrollopt'
|
2014-07-10 21:05:51 -07:00
|
|
|
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
|
2023-09-27 14:22:09 -07:00
|
|
|
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.
|
2014-07-10 21:05:51 -07:00
|
|
|
This allows quick adjustment of the relative offset of 'scrollbind' windows.
|
|
|
|
|
|
|
|
==============================================================================
|
|
|
|
6. Scrolling with a mouse wheel *scroll-mouse-wheel*
|
|
|
|
|
2017-02-26 19:10:55 -07:00
|
|
|
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.
|
2014-07-10 21:05:51 -07:00
|
|
|
|
|
|
|
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).
|
|
|
|
|
2022-07-06 04:34:24 -07:00
|
|
|
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.
|
2014-07-10 21:05:51 -07:00
|
|
|
|
2018-10-29 01:50:39 -07:00
|
|
|
vim:tw=78:ts=8:noet:ft=help:norl:
|