comparison runtime/doc/scroll.txt @ 2409:0ca06a92adfb vim73

Add support for horizontal scroll wheel. (Bjorn Winckler)
author Bram Moolenaar <bram@vim.org>
date Sun, 25 Jul 2010 15:49:07 +0200
parents 12b829477c60
children f766a1c87f69
comparison
equal deleted inserted replaced
2408:9e2e63af1641 2409:0ca06a92adfb
240 ============================================================================== 240 ==============================================================================
241 6. Scrolling with a mouse wheel *scroll-mouse-wheel* 241 6. Scrolling with a mouse wheel *scroll-mouse-wheel*
242 242
243 When your mouse has a scroll wheel, it should work with Vim in the GUI. How 243 When your mouse has a scroll wheel, it should work with Vim in the GUI. How
244 it works depends on your system. It might also work in an xterm 244 it works depends on your system. It might also work in an xterm
245 |xterm-mouse-wheel|. 245 |xterm-mouse-wheel|. By default only vertical scroll wheels are supported,
246 but some GUIs also support horizontal scroll wheels.
246 247
247 For the Win32 GUI the scroll action is hard coded. It works just like 248 For the Win32 GUI the scroll action is hard coded. It works just like
248 dragging the scrollbar of the current window. How many lines are scrolled 249 dragging the scrollbar of the current window. How many lines are scrolled
249 depends on your mouse driver. If the scroll action causes input focus 250 depends on your mouse driver. If the scroll action causes input focus
250 problems, see |intellimouse-wheel-problems|. 251 problems, see |intellimouse-wheel-problems|.
251 252
252 For the X11 GUIs (Motif, Athena and GTK) scrolling the wheel generates key 253 For the X11 GUIs (Motif, Athena and GTK) scrolling the wheel generates key
253 presses <MouseDown> and <MouseUp>. The default action for these keys are: 254 presses <ScrollWheelUp>, <ScrollWheelDown>, <ScrollWheelLeft> and
254 <MouseDown> scroll three lines down. *<MouseDown>* 255 <ScrollWheelRight>. For example, if you push the scroll wheel upwards a
255 <S-MouseDown> scroll a full page down. *<S-MouseDown>* 256 <ScrollWheelUp> key press is generated causing the window to scroll upwards
256 <C-MouseDown> scroll a full page down. *<C-MouseDown>* 257 (while the text is actually moving downwards). The default action for these
257 <MouseUp> scroll three lines up. *<MouseUp>* 258 keys are:
258 <S-MouseUp> scroll a full page up. *<S-MouseUp>* 259 <ScrollWheelUp> scroll three lines up *<ScrollWheelUp>*
259 <C-MouseUp> scroll a full page up. *<C-MouseUp>* 260 <S-ScrollWheelUp> scroll one page up *<S-ScrollWheelUp>*
261 <C-ScrollWheelUp> scroll one page up *<C-ScrollWheelUp>*
262 <ScrollWheelDown> scroll three lines down *<ScrollWheelDown>*
263 <S-ScrollWheelDown> scroll one page down *<S-ScrollWheelDown>*
264 <C-ScrollWheelDown> scroll one page down *<C-ScrollWheelDown>*
265 <ScrollWheelLeft> scroll six columns left *<ScrollWheelLeft>*
266 <S-ScrollWheelLeft> scroll one page left *<S-ScrollWheelLeft>*
267 <C-ScrollWheelLeft> scroll one page left *<C-ScrollWheelLeft>*
268 <ScrollWheelRight> scroll six columns right *<ScrollWheelRight>*
269 <S-ScrollWheelRight> scroll one page right *<S-ScrollWheelRight>*
270 <C-ScrollWheelRight> scroll one page right *<C-ScrollWheelRight>*
260 This should work in all modes, except when editing the command line. 271 This should work in all modes, except when editing the command line.
261 272
262 Note that <MouseDown> is used for scrolling the text down, this happens when 273 Note that horizontal scrolling only works if 'nowrap' is set. Also, unless
263 you turn the mouse wheel up! 274 the "h" flag in 'guioptions' is set, the cursor moves to the longest visible
264 275 line if the cursor line is about to be scrolled off the screen (similarly to
265 You can modify this behavior by mapping the keys. For example, to make the 276 how the horizontal scrollbar works).
266 scroll wheel move one line or half a page in Normal mode: > 277
267 :map <MouseDown> <C-Y> 278 You can modify the default behavior by mapping the keys. For example, to make
268 :map <S-MouseDown> <C-U> 279 the scroll wheel move one line or half a page in Normal mode: >
269 :map <MouseUp> <C-E> 280 :map <ScrollWheelUp> <C-Y>
270 :map <S-MouseUp> <C-D> 281 :map <S-ScrollWheelUp> <C-U>
282 :map <ScrollWheelDown> <C-E>
283 :map <S-ScrollWheelDown> <C-D>
271 You can also use Alt and Ctrl modifiers. 284 You can also use Alt and Ctrl modifiers.
272 285
273 This only works when Vim gets the scroll wheel events, of course. You can 286 This only works when Vim gets the scroll wheel events, of course. You can
274 check if this works with the "xev" program. 287 check if this works with the "xev" program.
275 288
278 Protocol "MouseMan" 291 Protocol "MouseMan"
279 Device "/dev/psm0" 292 Device "/dev/psm0"
280 ZAxisMapping 4 5 293 ZAxisMapping 4 5
281 See the XFree86 documentation for information. 294 See the XFree86 documentation for information.
282 295
296 *<MouseDown>* *<MouseUp>*
297 The keys <MouseDown> and <MouseUp> have been deprecated. Use <ScrollWheelUp>
298 instead of <MouseDown> and use <ScrollWheelDown> instead of <MouseUp>.
299
283 *xterm-mouse-wheel* 300 *xterm-mouse-wheel*
284 To use the mouse wheel in a new xterm you only have to make the scroll wheel 301 To use the mouse wheel in a new xterm you only have to make the scroll wheel
285 work in your Xserver, as mentioned above. 302 work in your Xserver, as mentioned above.
286 303
287 To use the mouse wheel in an older xterm you must do this: 304 To use the mouse wheel in an older xterm you must do this:
288 1. Make it work in your Xserver, as mentioned above. 305 1. Make it work in your Xserver, as mentioned above.
289 2. Add translations for the xterm, so that the xterm will pass a scroll event 306 2. Add translations for the xterm, so that the xterm will pass a scroll event
290 to Vim as an escape sequence. 307 to Vim as an escape sequence.
291 3. Add mappings in Vim, to interpret the escape sequences as <MouseUp> or 308 3. Add mappings in Vim, to interpret the escape sequences as <ScrollWheelDown>
292 <MouseDown> keys. 309 or <ScrollWheelUp> keys.
293 310
294 You can do the translations by adding this to your ~.Xdefaults file (or other 311 You can do the translations by adding this to your ~.Xdefaults file (or other
295 file where your X resources are kept): > 312 file where your X resources are kept): >
296 313
297 XTerm*VT100.Translations: #override \n\ 314 XTerm*VT100.Translations: #override \n\
301 <Btn5Down>: string("0x9b") string("[63~") \n\ 318 <Btn5Down>: string("0x9b") string("[63~") \n\
302 <Btn4Up>: \n\ 319 <Btn4Up>: \n\
303 <Btn5Up>: 320 <Btn5Up>:
304 321
305 Add these mappings to your vimrc file: > 322 Add these mappings to your vimrc file: >
306 :map <M-Esc>[62~ <MouseDown> 323 :map <M-Esc>[62~ <ScrollWheelUp>
307 :map! <M-Esc>[62~ <MouseDown> 324 :map! <M-Esc>[62~ <ScrollWheelUp>
308 :map <M-Esc>[63~ <MouseUp> 325 :map <M-Esc>[63~ <ScrollWheelDown>
309 :map! <M-Esc>[63~ <MouseUp> 326 :map! <M-Esc>[63~ <ScrollWheelDown>
310 :map <M-Esc>[64~ <S-MouseDown> 327 :map <M-Esc>[64~ <S-ScrollWheelUp>
311 :map! <M-Esc>[64~ <S-MouseDown> 328 :map! <M-Esc>[64~ <S-ScrollWheelUp>
312 :map <M-Esc>[65~ <S-MouseUp> 329 :map <M-Esc>[65~ <S-ScrollWheelDown>
313 :map! <M-Esc>[65~ <S-MouseUp> 330 :map! <M-Esc>[65~ <S-ScrollWheelDown>
314 < 331 <
315 vim:tw=78:ts=8:ft=help:norl: 332 vim:tw=78:ts=8:ft=help:norl: