robin/laufey

git clone https://git.robinwobin.dev/robin/laufey

zeertzjqMerge pull request #36504 from zeertzjq/vim-c8eeda9cf347110c1

master
10.4 KiB255 linesraw
1*scroll.txt*    Nvim
2
3
4		  VIM REFERENCE MANUAL	  by Bram Moolenaar
5
6
7Scrolling						*scrolling*
8
9These commands move the contents of the window.  If the cursor position is
10moved off of the window, the cursor is moved onto the window (with
11'scrolloff' screen lines around it).  A page is the number of lines in the
12window minus two.  The mnemonics for these commands may be a bit confusing.
13Remember that the commands refer to moving the window (the part of the buffer
14that you see) upwards or downwards in the buffer.  When the window moves
15upwards in the buffer, the text in the window moves downwards on your screen.
16
17See section |03.7| of the user manual for an introduction.
18
19                                      Type |gO| to see the table of contents.
20
21==============================================================================
221. Scrolling downwards					*scroll-down*
23
24The following commands move the edit window (the part of the buffer that you
25see) downwards (this means that more lines downwards in the text buffer can be
26seen):
27
28							*CTRL-E*
29CTRL-E			Scroll window [count] lines downwards in the buffer.
30			The text moves upwards on the screen.
31			Mnemonic: Extra lines.
32
33							*CTRL-D*
34CTRL-D			Scroll window Downwards in the buffer.  The number of
35			lines comes from the 'scroll' option (default: half a
36			screen).  If [count] given, first set 'scroll' option
37			to [count].  The cursor is moved the same number of
38			lines down in the file (if possible; when lines wrap
39			and when hitting the end of the file there may be a
40			difference).  When the cursor is on the last line of
41			the buffer nothing happens and a beep is produced.
42			See also 'startofline' option.
43
44<S-Down>	or				*<S-Down>* *<kPageDown>*
45<PageDown>	or				*<PageDown>* *CTRL-F*
46<S-CR>	or					*<S-CR>* *<S-NL>*
47<S-+>	or					*SHIFT-+* *<S-Plus>*
48CTRL-F			Scroll window [count] pages Forwards (downwards) in
49			the buffer.  See also 'startofline' option.
50			When there is only one window the 'window' option
51			might be used.
52
53							*z+*
54z+			Without [count]: Redraw with the line just below the
55			window at the top of the window.  Put the cursor in
56			that line, at the first non-blank in the line.
57			With [count]: just like "z<CR>".
58
59==============================================================================
602. Scrolling upwards					*scroll-up*
61
62The following commands move the edit window (the part of the buffer that you
63see) upwards (this means that more lines upwards in the text buffer can be
64seen):
65
66							*CTRL-Y*
67CTRL-Y			Scroll window [count] lines upwards in the buffer.
68			The text moves downwards on the screen.
69			Note: When using the MS-Windows key bindings CTRL-Y is
70			remapped to redo.
71
72							*CTRL-U*
73CTRL-U			Scroll window Upwards in the buffer.  The number of
74			lines comes from the 'scroll' option (default: half a
75			screen).  If [count] given, first set the 'scroll'
76			option to [count].  The cursor is moved the same
77			number of lines up in the file (if possible; when
78			lines wrap and when hitting the end of the file there
79			may be a difference).  When the cursor is on the first
80			line of the buffer nothing happens and a beep is
81			produced.  See also 'startofline' option.
82
83<S-Up>		or					*<S-Up>* *<kPageUp>*
84<PageUp>	or					*<PageUp>* *CTRL-B*
85<S-->		or				*<S-Minus>* *SHIFT-MINUS*
86CTRL-B			Scroll window [count] pages Backwards (upwards) in the
87			buffer.  See also 'startofline' option.
88			When there is only one window the 'window' option
89			might be used.
90
91							*z^*
92z^			Without [count]: Redraw with the line just above the
93			window at the bottom of the window.  Put the cursor in
94			that line, at the first non-blank in the line.
95			With [count]: First scroll the text to put the [count]
96			line at the bottom of the window, then redraw with the
97			line which is now at the top of the window at the
98			bottom of the window.  Put the cursor in that line, at
99			the first non-blank in the line.
100
101==============================================================================
1023. Scrolling relative to cursor				*scroll-cursor*
103
104The following commands reposition the edit window (the part of the buffer that
105you see) while keeping the cursor on the same line.  Note that the 'scrolloff'
106option may cause context lines to show above and below the cursor.
107
108							*z<CR>*
109z<CR>			Redraw, line [count] at top of window (default
110			cursor line).  Put cursor at first non-blank in the
111			line.
112
113							*zt*
114zt			Like "z<CR>", but leave the cursor in the same
115			column.
116
117							*zN<CR>*
118z{height}<CR>		Redraw, make window {height} lines tall.  This is
119			useful to make the number of lines small when screen
120			updating is very slow.  Cannot make the height more
121			than the physical screen height.
122
123							*z.*
124z.			Redraw, line [count] at center of window (default
125			cursor line).  Put cursor at first non-blank in the
126			line.
127
128							*zz*
129zz			Like "z.", but leave the cursor in the same column.
130			Careful: If caps-lock is on, this command becomes
131			"ZZ": write buffer and exit!
132
133							*z-*
134z-			Redraw, line [count] at bottom of window (default
135			cursor line).  Put cursor at first non-blank in the
136			line.
137
138							*zb*
139zb			Like "z-", but leave the cursor in the same column.
140
141==============================================================================
1424. Scrolling horizontally				*scroll-horizontal*
143
144For the following four commands the cursor follows the screen.  If the
145character that the cursor is on is moved off the screen, the cursor is moved
146to the closest character that is on the screen.  The value of 'sidescroll' is
147not used.
148
149z<Right>    or						*zl* *z<Right>*
150zl			Move the view on the text [count] characters to the
151			right, thus scroll the text [count] characters to the
152			left.  This only works when 'wrap' is off.
153
154z<Left>      or						*zh* *z<Left>*
155zh			Move the view on the text [count] characters to the
156			left, thus scroll the text [count] characters to the
157			right.  This only works when 'wrap' is off.
158
159							*zL*
160zL			Move the view on the text half a screenwidth to the
161			right, thus scroll the text half a screenwidth to the
162			left.  This only works when 'wrap' is off.
163
164							*zH*
165zH			Move the view on the text half a screenwidth to the
166			left, thus scroll the text half a screenwidth to the
167			right.  This only works when 'wrap' is off.
168
169For the following two commands the cursor is not moved in the text, only the
170text scrolls on the screen.
171
172							*zs*
173zs			Scroll the text horizontally to position the cursor
174			at the start (left side) of the screen.  This only
175			works when 'wrap' is off.
176
177							*ze*
178ze			Scroll the text horizontally to position the cursor
179			at the end (right side) of the screen.  This only
180			works when 'wrap' is off.
181
182==============================================================================
1835. Scrolling synchronously				*scroll-binding*
184
185Occasionally, it is desirable to bind two or more windows together such that
186when one window is scrolled, the other windows are also scrolled.  In Vim,
187windows can be given this behavior by setting the (window-specific)
188'scrollbind' option.  When a window that has 'scrollbind' set is scrolled, all
189other 'scrollbind' windows are scrolled the same amount, if possible.  The
190behavior of 'scrollbind' can be modified by the 'scrollopt' option.
191
192When using the scrollbars or the mouse wheel, the binding only happens when
193scrolling the window with focus (where the cursor is).  You can use this to
194avoid scroll-binding for a moment without resetting options.
195
196When a window also has the 'diff' option set, the scroll-binding uses the
197differences between the two buffers to synchronize the position precisely.
198Otherwise the following method is used.
199
200							*scrollbind-relative*
201Each 'scrollbind' window keeps track of its "relative offset", which can be
202thought of as the difference between the current window's vertical scroll
203position and the other window's vertical scroll position.  When one of the
204'scrollbind' windows is asked to vertically scroll past the beginning or end
205limit of its text, the window no longer scrolls, but remembers how far past
206the limit it wishes to be.  The window keeps this information so that it can
207maintain the same relative offset, regardless of its being asked to scroll
208past its buffer's limits.
209
210However, if a 'scrollbind' window that has a relative offset that is past its
211buffer's limits is given the cursor focus, the other 'scrollbind' windows must
212jump to a location where the current window's relative offset is valid.  This
213behavior can be changed by clearing the "jump" flag from the 'scrollopt'
214option.
215
216						*syncbind* *:syncbind* *:sync*
217:syncbind		Force all 'scrollbind' windows to have the same
218			relative offset.  I.e., when any of the 'scrollbind'
219			windows is scrolled to the top of its buffer, all of
220			the 'scrollbind' windows will also be at the top of
221			their buffers.
222
223							*scrollbind-quickadj*
224The 'scrollbind' flag is meaningful when using keyboard commands to vertically
225scroll a window, and is also meaningful when using the vertical scrollbar or
226the mouse wheel in the window which has the cursor focus.  However, when using
227the vertical scrollbar or the mouse wheel in a window which doesn't have the
228cursor focus, 'scrollbind' is ignored.
229This allows quick adjustment of the relative offset of 'scrollbind' windows.
230
231==============================================================================
2326. Scrolling with a mouse wheel				*scroll-mouse-wheel*
233
234When your mouse has a scroll wheel, it should work with Nvim in the GUI and
235any terminal that has mouse support.  By default only vertical scroll wheels
236are supported, but some GUIs also support horizontal scroll wheels.
237
238Note that horizontal scrolling only works if 'nowrap' is set.  Also, unless
239the "h" flag in 'guioptions' is set, the cursor moves to the longest visible
240line if the cursor line is about to be scrolled off the screen (similarly to
241how the horizontal scrollbar works).
242
243You can control the number of lines / columns to scroll by using the
244'mousescroll' option. You can also modify the default behavior by mapping
245the keys. For example, to scroll a page at a time in normal mode: >
246   :map <ScrollWheelUp> <C-B>
247   :map <ScrollWheelDown> <C-F>
248Scroll keys can also be combined with modifiers such as Shift, Ctrl, and Alt.
249
250When scrolling with a mouse, the window currently under the cursor is
251scrolled. This allows you to scroll inactive windows. Note that when scroll
252keys are remapped to keyboard keys, the active window is affected regardless
253of the current cursor position.
254
255 vim:tw=78:ts=8:noet:ft=help:norl: