scroll.txt (10635B)
1 *scroll.txt* Nvim 2 3 4 VIM REFERENCE MANUAL by Bram Moolenaar 5 6 7 Scrolling *scrolling* 8 9 These commands move the contents of the window. If the cursor position is 10 moved 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 12 window minus two. The mnemonics for these commands may be a bit confusing. 13 Remember that the commands refer to moving the window (the part of the buffer 14 that you see) upwards or downwards in the buffer. When the window moves 15 upwards in the buffer, the text in the window moves downwards on your screen. 16 17 See section |03.7| of the user manual for an introduction. 18 19 Type |gO| to see the table of contents. 20 21 ============================================================================== 22 1. Scrolling downwards *scroll-down* 23 24 The following commands move the edit window (the part of the buffer that you 25 see) downwards (this means that more lines downwards in the text buffer can be 26 seen): 27 28 *CTRL-E* 29 CTRL-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* 34 CTRL-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>* 48 CTRL-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+* 54 z+ 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 ============================================================================== 60 2. Scrolling upwards *scroll-up* 61 62 The following commands move the edit window (the part of the buffer that you 63 see) upwards (this means that more lines upwards in the text buffer can be 64 seen): 65 66 *CTRL-Y* 67 CTRL-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* 73 CTRL-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* 86 CTRL-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^* 92 z^ 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 ============================================================================== 102 3. Scrolling relative to cursor *scroll-cursor* 103 104 The following commands reposition the edit window (the part of the buffer that 105 you see) while keeping the cursor on the same line. Note that the 'scrolloff' 106 option may cause context lines to show above and below the cursor. 107 108 *z<CR>* 109 z<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* 114 zt Like "z<CR>", but leave the cursor in the same 115 column. 116 117 *zN<CR>* 118 z{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.* 124 z. Redraw, line [count] at center of window (default 125 cursor line). Put cursor at first non-blank in the 126 line. 127 128 *zz* 129 zz 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-* 134 z- Redraw, line [count] at bottom of window (default 135 cursor line). Put cursor at first non-blank in the 136 line. 137 138 *zb* 139 zb Like "z-", but leave the cursor in the same column. 140 141 ============================================================================== 142 4. Scrolling horizontally *scroll-horizontal* 143 144 For the following four commands the cursor follows the screen. If the 145 character that the cursor is on is moved off the screen, the cursor is moved 146 to the closest character that is on the screen. The value of 'sidescroll' is 147 not used. 148 149 z<Right> or *zl* *z<Right>* 150 zl 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 154 z<Left> or *zh* *z<Left>* 155 zh 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* 160 zL 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* 165 zH 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 169 For the following two commands the cursor is not moved in the text, only the 170 text scrolls on the screen. 171 172 *zs* 173 zs 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* 178 ze 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 ============================================================================== 183 5. Scrolling synchronously *scroll-binding* 184 185 Occasionally, it is desirable to bind two or more windows together such that 186 when one window is scrolled, the other windows are also scrolled. In Vim, 187 windows can be given this behavior by setting the (window-specific) 188 'scrollbind' option. When a window that has 'scrollbind' set is scrolled, all 189 other 'scrollbind' windows are scrolled the same amount, if possible. The 190 behavior of 'scrollbind' can be modified by the 'scrollopt' option. 191 192 When using the scrollbars or the mouse wheel, the binding only happens when 193 scrolling the window with focus (where the cursor is). You can use this to 194 avoid scroll-binding for a moment without resetting options. 195 196 When a window also has the 'diff' option set, the scroll-binding uses the 197 differences between the two buffers to synchronize the position precisely. 198 Otherwise the following method is used. 199 200 *scrollbind-relative* 201 Each 'scrollbind' window keeps track of its "relative offset", which can be 202 thought of as the difference between the current window's vertical scroll 203 position 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 205 limit of its text, the window no longer scrolls, but remembers how far past 206 the limit it wishes to be. The window keeps this information so that it can 207 maintain the same relative offset, regardless of its being asked to scroll 208 past its buffer's limits. 209 210 However, if a 'scrollbind' window that has a relative offset that is past its 211 buffer's limits is given the cursor focus, the other 'scrollbind' windows must 212 jump to a location where the current window's relative offset is valid. This 213 behavior can be changed by clearing the "jump" flag from the 'scrollopt' 214 option. 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* 224 The 'scrollbind' flag is meaningful when using keyboard commands to vertically 225 scroll a window, and is also meaningful when using the vertical scrollbar or 226 the mouse wheel in the window which has the cursor focus. However, when using 227 the vertical scrollbar or the mouse wheel in a window which doesn't have the 228 cursor focus, 'scrollbind' is ignored. 229 This allows quick adjustment of the relative offset of 'scrollbind' windows. 230 231 ============================================================================== 232 6. Scrolling with a mouse wheel *scroll-mouse-wheel* 233 234 When your mouse has a scroll wheel, it should work with Nvim in the GUI and 235 any terminal that has mouse support. By default only vertical scroll wheels 236 are supported, but some GUIs also support horizontal scroll wheels. 237 238 Note that horizontal scrolling only works if 'nowrap' is set. Also, unless 239 the "h" flag in 'guioptions' is set, the cursor moves to the longest visible 240 line if the cursor line is about to be scrolled off the screen (similarly to 241 how the horizontal scrollbar works). 242 243 You can control the number of lines / columns to scroll by using the 244 'mousescroll' option. You can also modify the default behavior by mapping 245 the keys. For example, to scroll a page at a time in normal mode: > 246 :map <ScrollWheelUp> <C-B> 247 :map <ScrollWheelDown> <C-F> 248 Scroll keys can also be combined with modifiers such as Shift, Ctrl, and Alt. 249 250 When scrolling with a mouse, the window currently under the cursor is 251 scrolled. This allows you to scroll inactive windows. Note that when scroll 252 keys are remapped to keyboard keys, the active window is affected regardless 253 of the current cursor position. 254 255 vim:tw=78:ts=8:noet:ft=help:norl: