Christian Brabandt | aaaa21b | 2024-07-06 11:29:38 +0200 | [diff] [blame] | 1 | *scroll.txt* For Vim version 9.1. Last change: 2024 Jul 06 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 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 | 1. Scrolling downwards |scroll-down| |
| 20 | 2. Scrolling upwards |scroll-up| |
| 21 | 3. Scrolling relative to cursor |scroll-cursor| |
| 22 | 4. Scrolling horizontally |scroll-horizontal| |
| 23 | 5. Scrolling synchronously |scroll-binding| |
| 24 | 6. Scrolling with a mouse wheel |scroll-mouse-wheel| |
| 25 | |
| 26 | ============================================================================== |
| 27 | 1. Scrolling downwards *scroll-down* |
| 28 | |
| 29 | The following commands move the edit window (the part of the buffer that you |
| 30 | see) downwards (this means that more lines downwards in the text buffer can be |
| 31 | seen): |
| 32 | |
| 33 | *CTRL-E* |
| 34 | CTRL-E Scroll window [count] lines downwards in the buffer. |
Bram Moolenaar | 15142e2 | 2018-04-30 22:19:58 +0200 | [diff] [blame] | 35 | The text moves upwards on the screen. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 36 | Mnemonic: Extra lines. |
| 37 | |
| 38 | *CTRL-D* |
| 39 | CTRL-D Scroll window Downwards in the buffer. The number of |
| 40 | lines comes from the 'scroll' option (default: half a |
| 41 | screen). If [count] given, first set 'scroll' option |
| 42 | to [count]. The cursor is moved the same number of |
| 43 | lines down in the file (if possible; when lines wrap |
| 44 | and when hitting the end of the file there may be a |
| 45 | difference). When the cursor is on the last line of |
| 46 | the buffer nothing happens and a beep is produced. |
| 47 | See also 'startofline' option. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 48 | |
| 49 | <S-Down> or *<S-Down>* *<kPageDown>* |
| 50 | <PageDown> or *<PageDown>* *CTRL-F* |
Christian Brabandt | aaaa21b | 2024-07-06 11:29:38 +0200 | [diff] [blame] | 51 | <S-CR> or *<S-CR>* *<S-NL>* |
Christian Brabandt | 6a4afb1 | 2024-07-05 21:09:35 +0200 | [diff] [blame] | 52 | <S-+> or *SHIFT-+* *<S-Plus>* |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 53 | CTRL-F Scroll window [count] pages Forwards (downwards) in |
| 54 | the buffer. See also 'startofline' option. |
Bram Moolenaar | 4399ef4 | 2005-02-12 14:29:27 +0000 | [diff] [blame] | 55 | When there is only one window the 'window' option |
| 56 | might be used. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 57 | |
| 58 | *z+* |
| 59 | z+ Without [count]: Redraw with the line just below the |
| 60 | window at the top of the window. Put the cursor in |
| 61 | that line, at the first non-blank in the line. |
| 62 | With [count]: just like "z<CR>". |
| 63 | |
| 64 | ============================================================================== |
| 65 | 2. Scrolling upwards *scroll-up* |
| 66 | |
| 67 | The following commands move the edit window (the part of the buffer that you |
| 68 | see) upwards (this means that more lines upwards in the text buffer can be |
| 69 | seen): |
| 70 | |
| 71 | *CTRL-Y* |
| 72 | CTRL-Y Scroll window [count] lines upwards in the buffer. |
Bram Moolenaar | 15142e2 | 2018-04-30 22:19:58 +0200 | [diff] [blame] | 73 | The text moves downwards on the screen. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 74 | Note: When using the MS-Windows key bindings CTRL-Y is |
| 75 | remapped to redo. |
| 76 | |
| 77 | *CTRL-U* |
| 78 | CTRL-U Scroll window Upwards in the buffer. The number of |
| 79 | lines comes from the 'scroll' option (default: half a |
| 80 | screen). If [count] given, first set the 'scroll' |
| 81 | option to [count]. The cursor is moved the same |
| 82 | number of lines up in the file (if possible; when |
| 83 | lines wrap and when hitting the end of the file there |
| 84 | may be a difference). When the cursor is on the first |
| 85 | line of the buffer nothing happens and a beep is |
| 86 | produced. See also 'startofline' option. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 87 | |
| 88 | <S-Up> or *<S-Up>* *<kPageUp>* |
| 89 | <PageUp> or *<PageUp>* *CTRL-B* |
Christian Brabandt | 6a4afb1 | 2024-07-05 21:09:35 +0200 | [diff] [blame] | 90 | <S--> or *<S-Minus>* *SHIFT-MINUS* |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 91 | CTRL-B Scroll window [count] pages Backwards (upwards) in the |
| 92 | buffer. See also 'startofline' option. |
Bram Moolenaar | 4399ef4 | 2005-02-12 14:29:27 +0000 | [diff] [blame] | 93 | When there is only one window the 'window' option |
| 94 | might be used. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 95 | |
| 96 | *z^* |
| 97 | z^ Without [count]: Redraw with the line just above the |
| 98 | window at the bottom of the window. Put the cursor in |
| 99 | that line, at the first non-blank in the line. |
| 100 | With [count]: First scroll the text to put the [count] |
| 101 | line at the bottom of the window, then redraw with the |
| 102 | line which is now at the top of the window at the |
| 103 | bottom of the window. Put the cursor in that line, at |
| 104 | the first non-blank in the line. |
| 105 | |
| 106 | ============================================================================== |
| 107 | 3. Scrolling relative to cursor *scroll-cursor* |
| 108 | |
| 109 | The following commands reposition the edit window (the part of the buffer that |
Bram Moolenaar | c0514bf | 2016-11-17 14:50:09 +0100 | [diff] [blame] | 110 | you see) while keeping the cursor on the same line. Note that the 'scrolloff' |
| 111 | option may cause context lines to show above and below the cursor. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 112 | |
| 113 | *z<CR>* |
| 114 | z<CR> Redraw, line [count] at top of window (default |
| 115 | cursor line). Put cursor at first non-blank in the |
| 116 | line. |
| 117 | |
| 118 | *zt* |
| 119 | zt Like "z<CR>", but leave the cursor in the same |
Bram Moolenaar | 25c9c68 | 2019-05-05 18:13:34 +0200 | [diff] [blame] | 120 | column. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 121 | |
| 122 | *zN<CR>* |
| 123 | z{height}<CR> Redraw, make window {height} lines tall. This is |
| 124 | useful to make the number of lines small when screen |
| 125 | updating is very slow. Cannot make the height more |
| 126 | than the physical screen height. |
| 127 | |
| 128 | *z.* |
| 129 | z. Redraw, line [count] at center of window (default |
| 130 | cursor line). Put cursor at first non-blank in the |
| 131 | line. |
| 132 | |
| 133 | *zz* |
| 134 | zz Like "z.", but leave the cursor in the same column. |
Bram Moolenaar | 06b5d51 | 2010-05-22 15:37:44 +0200 | [diff] [blame] | 135 | Careful: If caps-lock is on, this command becomes |
Bram Moolenaar | 25c9c68 | 2019-05-05 18:13:34 +0200 | [diff] [blame] | 136 | "ZZ": write buffer and exit! |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 137 | |
| 138 | *z-* |
| 139 | z- Redraw, line [count] at bottom of window (default |
| 140 | cursor line). Put cursor at first non-blank in the |
| 141 | line. |
| 142 | |
| 143 | *zb* |
| 144 | zb Like "z-", but leave the cursor in the same column. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 145 | |
| 146 | ============================================================================== |
| 147 | 4. Scrolling horizontally *scroll-horizontal* |
| 148 | |
| 149 | For the following four commands the cursor follows the screen. If the |
| 150 | character that the cursor is on is moved off the screen, the cursor is moved |
| 151 | to the closest character that is on the screen. The value of 'sidescroll' is |
| 152 | not used. |
| 153 | |
| 154 | z<Right> or *zl* *z<Right>* |
Bram Moolenaar | 146522e | 2005-12-16 21:55:46 +0000 | [diff] [blame] | 155 | zl Move the view on the text [count] characters to the |
| 156 | right, thus scroll the text [count] characters to the |
Bram Moolenaar | 25c9c68 | 2019-05-05 18:13:34 +0200 | [diff] [blame] | 157 | left. This only works when 'wrap' is off. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 158 | |
| 159 | z<Left> or *zh* *z<Left>* |
Bram Moolenaar | 146522e | 2005-12-16 21:55:46 +0000 | [diff] [blame] | 160 | zh Move the view on the text [count] characters to the |
| 161 | left, thus scroll the text [count] characters to the |
Bram Moolenaar | 25c9c68 | 2019-05-05 18:13:34 +0200 | [diff] [blame] | 162 | right. This only works when 'wrap' is off. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 163 | |
| 164 | *zL* |
Bram Moolenaar | 146522e | 2005-12-16 21:55:46 +0000 | [diff] [blame] | 165 | zL Move the view on the text half a screenwidth to the |
| 166 | right, thus scroll the text half a screenwidth to the |
Bram Moolenaar | 25c9c68 | 2019-05-05 18:13:34 +0200 | [diff] [blame] | 167 | left. This only works when 'wrap' is off. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 168 | |
| 169 | *zH* |
Bram Moolenaar | 146522e | 2005-12-16 21:55:46 +0000 | [diff] [blame] | 170 | zH Move the view on the text half a screenwidth to the |
| 171 | left, thus scroll the text half a screenwidth to the |
Bram Moolenaar | 25c9c68 | 2019-05-05 18:13:34 +0200 | [diff] [blame] | 172 | right. This only works when 'wrap' is off. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 173 | |
| 174 | For the following two commands the cursor is not moved in the text, only the |
| 175 | text scrolls on the screen. |
| 176 | |
| 177 | *zs* |
Bram Moolenaar | 146522e | 2005-12-16 21:55:46 +0000 | [diff] [blame] | 178 | zs Scroll the text horizontally to position the cursor |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 179 | at the start (left side) of the screen. This only |
Bram Moolenaar | 25c9c68 | 2019-05-05 18:13:34 +0200 | [diff] [blame] | 180 | works when 'wrap' is off. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 181 | |
| 182 | *ze* |
Bram Moolenaar | 146522e | 2005-12-16 21:55:46 +0000 | [diff] [blame] | 183 | ze Scroll the text horizontally to position the cursor |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 184 | at the end (right side) of the screen. This only |
Bram Moolenaar | 25c9c68 | 2019-05-05 18:13:34 +0200 | [diff] [blame] | 185 | works when 'wrap' is off. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 186 | |
| 187 | ============================================================================== |
| 188 | 5. Scrolling synchronously *scroll-binding* |
| 189 | |
| 190 | Occasionally, it is desirable to bind two or more windows together such that |
Bram Moolenaar | 06b5d51 | 2010-05-22 15:37:44 +0200 | [diff] [blame] | 191 | when one window is scrolled, the other windows are also scrolled. In Vim, |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 192 | windows can be given this behavior by setting the (window-specific) |
| 193 | 'scrollbind' option. When a window that has 'scrollbind' set is scrolled, all |
| 194 | other 'scrollbind' windows are scrolled the same amount, if possible. The |
| 195 | behavior of 'scrollbind' can be modified by the 'scrollopt' option. |
| 196 | |
zeertzjq | 5277cfa | 2023-09-28 01:00:12 +0800 | [diff] [blame] | 197 | When using the scrollbars or the mouse wheel, the binding only happens when |
| 198 | scrolling the window with focus (where the cursor is). You can use this to |
| 199 | avoid scroll-binding for a moment without resetting options. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 200 | |
| 201 | When a window also has the 'diff' option set, the scroll-binding uses the |
| 202 | differences between the two buffers to synchronize the position precisely. |
| 203 | Otherwise the following method is used. |
| 204 | |
| 205 | *scrollbind-relative* |
zeertzjq | 5277cfa | 2023-09-28 01:00:12 +0800 | [diff] [blame] | 206 | Each 'scrollbind' window keeps track of its "relative offset", which can be |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 207 | thought of as the difference between the current window's vertical scroll |
| 208 | position and the other window's vertical scroll position. When one of the |
| 209 | 'scrollbind' windows is asked to vertically scroll past the beginning or end |
| 210 | limit of its text, the window no longer scrolls, but remembers how far past |
| 211 | the limit it wishes to be. The window keeps this information so that it can |
| 212 | maintain the same relative offset, regardless of its being asked to scroll |
| 213 | past its buffer's limits. |
| 214 | |
| 215 | However, if a 'scrollbind' window that has a relative offset that is past its |
| 216 | buffer's limits is given the cursor focus, the other 'scrollbind' windows must |
| 217 | jump to a location where the current window's relative offset is valid. This |
Bram Moolenaar | 214641f | 2017-03-05 17:04:09 +0100 | [diff] [blame] | 218 | behavior can be changed by clearing the "jump" flag from the 'scrollopt' |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 219 | option. |
| 220 | |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 221 | *syncbind* *:syncbind* *:sync* |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 222 | :syncbind Force all 'scrollbind' windows to have the same |
| 223 | relative offset. I.e., when any of the 'scrollbind' |
| 224 | windows is scrolled to the top of its buffer, all of |
| 225 | the 'scrollbind' windows will also be at the top of |
| 226 | their buffers. |
| 227 | |
| 228 | *scrollbind-quickadj* |
| 229 | The 'scrollbind' flag is meaningful when using keyboard commands to vertically |
zeertzjq | 5277cfa | 2023-09-28 01:00:12 +0800 | [diff] [blame] | 230 | scroll a window, and is also meaningful when using the vertical scrollbar or |
| 231 | the mouse wheel in the window which has the cursor focus. However, when using |
| 232 | the vertical scrollbar or the mouse wheel in a window which doesn't have the |
| 233 | cursor focus, 'scrollbind' is ignored. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 234 | This allows quick adjustment of the relative offset of 'scrollbind' windows. |
| 235 | |
| 236 | ============================================================================== |
| 237 | 6. Scrolling with a mouse wheel *scroll-mouse-wheel* |
| 238 | |
| 239 | When your mouse has a scroll wheel, it should work with Vim in the GUI. How |
| 240 | it works depends on your system. It might also work in an xterm |
Bram Moolenaar | 8d9b40e | 2010-07-25 15:49:07 +0200 | [diff] [blame] | 241 | |xterm-mouse-wheel|. By default only vertical scroll wheels are supported, |
| 242 | but some GUIs also support horizontal scroll wheels. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 243 | |
LemonBoy | c27747e | 2022-05-07 12:25:40 +0100 | [diff] [blame] | 244 | On MS-Windows, if the scroll action causes input focus -problems, see |
| 245 | |intellimouse-wheel-problems|. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 246 | |
LemonBoy | c27747e | 2022-05-07 12:25:40 +0100 | [diff] [blame] | 247 | For Win32 and the X11 GUIs (Motif and GTK) scrolling the wheel generates key |
Bram Moolenaar | 8d9b40e | 2010-07-25 15:49:07 +0200 | [diff] [blame] | 248 | presses <ScrollWheelUp>, <ScrollWheelDown>, <ScrollWheelLeft> and |
| 249 | <ScrollWheelRight>. For example, if you push the scroll wheel upwards a |
| 250 | <ScrollWheelUp> key press is generated causing the window to scroll upwards |
| 251 | (while the text is actually moving downwards). The default action for these |
| 252 | keys are: |
LemonBoy | c27747e | 2022-05-07 12:25:40 +0100 | [diff] [blame] | 253 | <ScrollWheelUp> scroll N lines up *<ScrollWheelUp>* |
Bram Moolenaar | 8d9b40e | 2010-07-25 15:49:07 +0200 | [diff] [blame] | 254 | <S-ScrollWheelUp> scroll one page up *<S-ScrollWheelUp>* |
| 255 | <C-ScrollWheelUp> scroll one page up *<C-ScrollWheelUp>* |
LemonBoy | c27747e | 2022-05-07 12:25:40 +0100 | [diff] [blame] | 256 | <ScrollWheelDown> scroll N lines down *<ScrollWheelDown>* |
Bram Moolenaar | 8d9b40e | 2010-07-25 15:49:07 +0200 | [diff] [blame] | 257 | <S-ScrollWheelDown> scroll one page down *<S-ScrollWheelDown>* |
| 258 | <C-ScrollWheelDown> scroll one page down *<C-ScrollWheelDown>* |
LemonBoy | c27747e | 2022-05-07 12:25:40 +0100 | [diff] [blame] | 259 | <ScrollWheelLeft> scroll N columns left *<ScrollWheelLeft>* |
Bram Moolenaar | 8d9b40e | 2010-07-25 15:49:07 +0200 | [diff] [blame] | 260 | <S-ScrollWheelLeft> scroll one page left *<S-ScrollWheelLeft>* |
| 261 | <C-ScrollWheelLeft> scroll one page left *<C-ScrollWheelLeft>* |
LemonBoy | c27747e | 2022-05-07 12:25:40 +0100 | [diff] [blame] | 262 | <ScrollWheelRight> scroll N columns right *<ScrollWheelRight>* |
Bram Moolenaar | 8d9b40e | 2010-07-25 15:49:07 +0200 | [diff] [blame] | 263 | <S-ScrollWheelRight> scroll one page right *<S-ScrollWheelRight>* |
| 264 | <C-ScrollWheelRight> scroll one page right *<C-ScrollWheelRight>* |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 265 | This should work in all modes, except when editing the command line. |
| 266 | |
LemonBoy | c27747e | 2022-05-07 12:25:40 +0100 | [diff] [blame] | 267 | The value of N depends on the system. By default Vim scrolls three lines when |
| 268 | moving vertically, and six columns when moving horizontally. On MS-Windows |
| 269 | the amount of lines and columns for each scroll action is taken from the |
| 270 | system-wide settings. |
| 271 | |
Bram Moolenaar | 8d9b40e | 2010-07-25 15:49:07 +0200 | [diff] [blame] | 272 | Note that horizontal scrolling only works if 'nowrap' is set. Also, unless |
| 273 | the "h" flag in 'guioptions' is set, the cursor moves to the longest visible |
| 274 | line if the cursor line is about to be scrolled off the screen (similarly to |
| 275 | how the horizontal scrollbar works). |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 276 | |
Bram Moolenaar | 8d9b40e | 2010-07-25 15:49:07 +0200 | [diff] [blame] | 277 | You can modify the default behavior by mapping the keys. For example, to make |
| 278 | the scroll wheel move one line or half a page in Normal mode: > |
| 279 | :map <ScrollWheelUp> <C-Y> |
| 280 | :map <S-ScrollWheelUp> <C-U> |
| 281 | :map <ScrollWheelDown> <C-E> |
| 282 | :map <S-ScrollWheelDown> <C-D> |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 283 | You can also use Alt and Ctrl modifiers. |
| 284 | |
| 285 | This only works when Vim gets the scroll wheel events, of course. You can |
| 286 | check if this works with the "xev" program. |
Bram Moolenaar | 6ebe4f9 | 2022-10-28 20:47:54 +0100 | [diff] [blame] | 287 | *mouse-scrolling-off* |
| 288 | If you do not want the mouse to cause scrolling (e.g. because resting your |
| 289 | palm on the touchpad causes scroll events), you can disable that with: > |
| 290 | :map <ScrollWheelDown> <Nop> |
| 291 | :map! <ScrollWheelDown> <Nop> |
| 292 | :map <ScrollWheelUp> <Nop> |
| 293 | :map! <ScrollWheelUp> <Nop> |
| 294 | :map <ScrollWheelLeft> <Nop> |
| 295 | :map! <ScrollWheelLeft> <Nop> |
| 296 | :map <ScrollWheelRight> <Nop> |
| 297 | :map! <ScrollWheelRight> <Nop> |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 298 | |
Bram Moolenaar | 13fcaaf | 2005-04-15 21:13:42 +0000 | [diff] [blame] | 299 | When using XFree86, the /etc/XF86Config file should have the correct entry for |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 300 | your mouse. For FreeBSD, this entry works for a Logitech scrollmouse: > |
| 301 | Protocol "MouseMan" |
| 302 | Device "/dev/psm0" |
| 303 | ZAxisMapping 4 5 |
Bram Moolenaar | 13fcaaf | 2005-04-15 21:13:42 +0000 | [diff] [blame] | 304 | See the XFree86 documentation for information. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 305 | |
Bram Moolenaar | 8d9b40e | 2010-07-25 15:49:07 +0200 | [diff] [blame] | 306 | *<MouseDown>* *<MouseUp>* |
| 307 | The keys <MouseDown> and <MouseUp> have been deprecated. Use <ScrollWheelUp> |
| 308 | instead of <MouseDown> and use <ScrollWheelDown> instead of <MouseUp>. |
| 309 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 310 | *xterm-mouse-wheel* |
| 311 | To use the mouse wheel in a new xterm you only have to make the scroll wheel |
| 312 | work in your Xserver, as mentioned above. |
| 313 | |
| 314 | To use the mouse wheel in an older xterm you must do this: |
| 315 | 1. Make it work in your Xserver, as mentioned above. |
| 316 | 2. Add translations for the xterm, so that the xterm will pass a scroll event |
| 317 | to Vim as an escape sequence. |
Bram Moolenaar | 8d9b40e | 2010-07-25 15:49:07 +0200 | [diff] [blame] | 318 | 3. Add mappings in Vim, to interpret the escape sequences as <ScrollWheelDown> |
| 319 | or <ScrollWheelUp> keys. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 320 | |
| 321 | You can do the translations by adding this to your ~.Xdefaults file (or other |
| 322 | file where your X resources are kept): > |
| 323 | |
| 324 | XTerm*VT100.Translations: #override \n\ |
| 325 | s<Btn4Down>: string("0x9b") string("[64~") \n\ |
| 326 | s<Btn5Down>: string("0x9b") string("[65~") \n\ |
| 327 | <Btn4Down>: string("0x9b") string("[62~") \n\ |
| 328 | <Btn5Down>: string("0x9b") string("[63~") \n\ |
| 329 | <Btn4Up>: \n\ |
| 330 | <Btn5Up>: |
| 331 | |
| 332 | Add these mappings to your vimrc file: > |
Bram Moolenaar | 8d9b40e | 2010-07-25 15:49:07 +0200 | [diff] [blame] | 333 | :map <M-Esc>[62~ <ScrollWheelUp> |
| 334 | :map! <M-Esc>[62~ <ScrollWheelUp> |
| 335 | :map <M-Esc>[63~ <ScrollWheelDown> |
| 336 | :map! <M-Esc>[63~ <ScrollWheelDown> |
| 337 | :map <M-Esc>[64~ <S-ScrollWheelUp> |
| 338 | :map! <M-Esc>[64~ <S-ScrollWheelUp> |
| 339 | :map <M-Esc>[65~ <S-ScrollWheelDown> |
| 340 | :map! <M-Esc>[65~ <S-ScrollWheelDown> |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 341 | < |
Bram Moolenaar | 91f84f6 | 2018-07-29 15:07:52 +0200 | [diff] [blame] | 342 | vim:tw=78:ts=8:noet:ft=help:norl: |