home *** CD-ROM | disk | FTP | other *** search
/ vim.ftp.fu-berlin.de / 2015-02-03.vim.ftp.fu-berlin.de.tar / vim.ftp.fu-berlin.de / mac / vim55rt.sit / runtime / doc / scroll.txt < prev    next >
Encoding:
Text File  |  1999-09-25  |  10.6 KB  |  270 lines  |  [TEXT/MPS ]

  1. *scroll.txt*    For Vim version 5.5.  Last change: 1999 Sep 19
  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. 1. Scrolling downwards        |scroll-down|
  18. 2. Scrolling upwards        |scroll-up|
  19. 3. Scrolling relative to cursor    |scroll-cursor|
  20. 4. Scrolling horizontally    |scroll-horizontal|
  21. 5. Scrolling synchronously    |scroll-binding|
  22. 6. Scrolling with a mouse wheel |scroll-mouse-wheel|
  23.  
  24. ==============================================================================
  25. 1. Scrolling downwards                    *scroll-down*
  26.  
  27. The following commands move the edit window (the part of the buffer that you
  28. see) downwards (this means that more lines downwards in the text buffer can be
  29. seen):
  30.  
  31.                             *CTRL-E*
  32. CTRL-E            Scroll window [count] lines downwards in the buffer.
  33.             Mnemonic: Extra lines.
  34.  
  35.                             *CTRL-D*
  36. CTRL-D            Scroll window Downwards in the buffer.  The number of
  37.             lines comes from the 'scroll' option (default: half a
  38.             screen).  If [count] given, first set 'scroll' option
  39.             to [count].  The cursor is moved the same number of
  40.             lines down in the file (if possible; when lines wrap
  41.             and when hitting the end of the file there may be a
  42.             difference).  When the cursor is on the last line of
  43.             the buffer nothing happens and a beep is produced.
  44.             See also 'startofline' option.
  45.             {difference from vi: Vim scrolls 'scroll' screen
  46.             lines, instead of file lines; makes a difference when
  47.             lines wrap}
  48.  
  49. <S-Down>    or                *<S-Down>* *<kPageDown>*
  50. <PageDown>    or                *<PageDown>* *CTRL-F*
  51. CTRL-F            Scroll window [count] pages Forwards (downwards) in
  52.             the buffer.  See also 'startofline' option.
  53.  
  54. ==============================================================================
  55. 2. Scrolling upwards                    *scroll-up*
  56.  
  57. The following commands move the edit window (the part of the buffer that you
  58. see) upwards (this means that more lines upwards in the text buffer can be
  59. seen):
  60.  
  61.                             *CTRL-Y*
  62. CTRL-Y            Scroll window [count] lines upwards in the buffer.
  63.  
  64.                             *CTRL-U*
  65. CTRL-U            Scroll window Upwards in the buffer.  The number of
  66.             lines comes from the 'scroll' option (default: half a
  67.             screen).  If [count] given, first set the 'scroll'
  68.             option to [count].  The cursor is moved the same
  69.             number of lines up in the file (if possible; when
  70.             lines wrap and when hitting the end of the file there
  71.             may be a difference).  When the cursor is on the first
  72.             line of the buffer nothing happens and a beep is
  73.             produced.  See also 'startofline' option.
  74.             {difference from vi: Vim scrolls 'scroll' screen
  75.             lines, instead of file lines; makes a difference when
  76.             lines wrap}
  77.  
  78. <S-Up>        or                    *<S-Up>* *<kPageUp>*
  79. <PageUp>    or                    *<PageUp>* *CTRL-B*
  80. CTRL-B            Scroll window [count] pages Backwards (upwards) in the
  81.             buffer.  See also 'startofline' option.
  82.  
  83. ==============================================================================
  84. 3. Scrolling relative to cursor                *scroll-cursor*
  85.  
  86. The following commands reposition the edit window (the part of the buffer that
  87. you see) while keeping the cursor on the same line:
  88.  
  89.                             *z* *z<CR>*
  90. z<CR>            Redraw, line [count] at top of window (default
  91.             cursor line).  Put cursor at first non-blank in the
  92.             line.
  93.  
  94.                             *zt*
  95. zt            Like "z<CR>", but leave the cursor in the same
  96.             column.  {not in Vi}
  97.  
  98.                             *zN<CR>*
  99. z{height}<CR>        Redraw, make window {height} lines tall.  This is
  100.             useful to make the number of lines small when screen
  101.             updating is very slow.  Cannot make the height more
  102.             than the physical screen height.
  103.  
  104.                             *z.*
  105. z.            Redraw, line [count] at center of window (default
  106.             cursor line).  Put cursor at first non-blank in the
  107.             line.
  108.  
  109.                             *zz*
  110. zz            Like "z.", but leave the cursor in the same column.
  111.             Careful: If caps-lock is on, this commands becomes
  112.             "ZZ": write buffer and exit!  {not in Vi}
  113.  
  114.                             *z-*
  115. z-            Redraw, line [count] at bottom of window (default
  116.             cursor line).  Put cursor at first non-blank in the
  117.             line.
  118.  
  119.                             *zb*
  120. zb            Like "z-", but leave the cursor in the same column.
  121.             {not in Vi}
  122.  
  123. ==============================================================================
  124. 4. Scrolling horizontally                *scroll-horizontal*
  125.  
  126. For the following four commands the cursor follows the screen.  If the
  127. character that the cursor is on is moved off the screen, the cursor is moved
  128. to the closest character that is on the screen.  The value of 'sidescroll' is
  129. not used.
  130.  
  131. z<Right>    or                        *zl* *z<Right>*
  132. zl            Scroll the screen [count] characters to the left.
  133.             This only works when 'wrap' is off.  {not in Vi}
  134.  
  135. z<Left>      or                        *zh* *z<Left>*
  136. zh            Scroll the screen [count] characters to the right.
  137.             This only works when 'wrap' is off.  {not in Vi}
  138.  
  139.                             *zL*
  140. zL            Scroll the screen half a screenwidth to the left.
  141.             This only works when 'wrap' is off.  {not in Vi}
  142.  
  143.                             *zH*
  144. zH            Scroll the screen half a screenwith to the right.
  145.             This only works when 'wrap' is off.  {not in Vi}
  146.  
  147. For the following two commands the cursor is not moved in the text, only the
  148. text scrolls on the screen.
  149.  
  150.                             *zs*
  151. zs            Scroll the screen horizontally to position the cursor
  152.             at the start (left side) of the screen.  This only
  153.             works when 'wrap' is off.  {not in Vi}
  154.  
  155.                             *ze*
  156. ze            Scroll the screen horizontally to position the cursor
  157.             at the end (right side) of the screen.  This only
  158.             works when 'wrap' is off.  {not in Vi}
  159.  
  160. ==============================================================================
  161. 5. Scrolling synchronously                *scroll-binding*
  162.  
  163. Occasionally, it is desirable to bind two or more windows together such that
  164. when one window is scrolled, the other windows are scrolled also.  In Vim,
  165. windows can be given this behavior by setting the (window-specific)
  166. 'scrollbind' option.  When a window that has 'scrollbind' set is scrolled, all
  167. other 'scrollbind' windows are scrolled the same amount, if possible.  The
  168. behavior of 'scrollbind' can be modified by the 'scrollopt' option.
  169.  
  170.                             *scrollbind-relative*
  171. Each 'scrollbind' window keeps track of its "relative offset," which can be
  172. thought of as the difference between the current window's vertical scroll
  173. position and the other window's vertical scroll position.  When one of the
  174. 'scrollbind' windows is asked to vertically scroll past the beginning or end
  175. limit of its text, the window no longer scrolls, but remembers how far past
  176. the limit it wishes to be.  The window keeps this information so that it can
  177. maintain the same relative offset, regardless of its being asked to scroll
  178. past its buffer's limits.
  179.  
  180. However, if a 'scrollbind' window that has a relative offset that is past its
  181. buffer's limits is given the cursor focus, the other 'scrollbind' windows must
  182. jump to a location where the current window's relative offset is valid.  This
  183. behavior can be changed by clearing the 'jump' flag from the 'scrollopt'
  184. option.
  185.  
  186.                             *syncbind* *:syncbind*
  187. :syncbind        Force all 'scrollbind' windows to have the same
  188.             relative offset.  I.e., when any of the 'scrollbind'
  189.             windows is scrolled to the top of its buffer, all of
  190.             the 'scrollbind' windows will also be at the top of
  191.             their buffers.
  192.  
  193.                             *scrollbind-quickadj*
  194. The 'scrollbind' flag is meaningful when using keyboard commands to vertically
  195. scroll a window, and also meaningful when using the vertical scrollbar of the
  196. window which has the cursor focus.  However, when using the vertical scrollbar
  197. of a window which doesn't have the cursor focus, 'scrollbind' is ignored.
  198. This allows quick adjustment of the relative offset of 'scrollbind' windows.
  199.  
  200. ==============================================================================
  201. 6. Scrolling with a mouse wheel                *scroll-mouse-wheel*
  202.  
  203. When your mouse has a scroll wheel, it should work with Vim in the GUI.  How
  204. it works depends on your system.  It might also work in an xterm
  205. |xterm-mouse-wheel|.
  206.  
  207. For the Win32 GUI the scroll action is hard coded.  It works just like
  208. dragging the scrollbar of the current window.  How many lines are scrolled
  209. depends on your mouse driver.  If the scroll action causes input focus
  210. problems, see |intellimouse-wheel-problems|.
  211.  
  212. For the X11 GUIs (Motif, Athena and GTK) scrolling the wheel generates key
  213. presses <MouseDown> and <MouseUp>.  The default action for these keys are:
  214.     <MouseDown>        scroll three lines down.    *<MouseDown>*
  215.     <S-MouseDown>    scroll a full page down.    *<S-MouseDown>*
  216.     <MouseUp>        scroll three lines up.        *<MouseUp>*
  217.     <S-MouseUp>        scroll a full page up.        *<S-MouseUp>*
  218. This should work in all modes, except when editing the command line.
  219.  
  220. You can modify this behavior by mapping the keys.  For example, to make the
  221. scroll wheel move one line or half a page in Normal mode:
  222. >   map <MouseDown> <C-Y>
  223. >   map <S-MouseDown> <C-U>
  224. >   map <MouseUp> <C-E>
  225. >   map <S-MouseUp> <C-D>
  226. You can also use Alt and Ctrl modifiers.
  227.  
  228. This only works when Vim gets the scroll wheel events, of course.  You can
  229. check if this works with the "xev" program.
  230.  
  231. When using Xfree86, the /etc/XF86Config file should have the correct entry for
  232. your mouse.  For FreeBSD, this entry works for a Logitech scrollmouse:
  233. >   Protocol     "MouseMan"
  234. >   Device       "/dev/psm0"
  235. >   ZAxisMapping 4 5
  236. See the Xfree86 documentation for information.
  237.  
  238.                             *xterm-mouse-wheel*
  239. To use the mouse wheel in an xterm you must do this:
  240. 1. Make it work in your Xserver, as mentioned above.
  241. 2. Add translations for the xterm, so that the xterm will pass a scroll event
  242.    to Vim as an escape sequence.
  243. 3. Add mappings in Vim, to interpret the escape sequences as <MouseUp> or
  244.    <MouseDown> keys.
  245.  
  246. You can do the translations by adding this to your ~.Xdefaults file (or other
  247. file where your X resources are kept):
  248.  
  249. > *VT100.Translations:        #override \n\
  250. >         s<Btn4Down>: string("0x1b") string("[64~") \n\
  251. >         s<Btn5Down>: string("0x1b") string("[65~") \n\
  252. >         <Btn4Down>: string("0x1b") string("[62~") \n\
  253. >         <Btn5Down>: string("0x1b") string("[63~")
  254.  
  255. If these don't work (because other translations get in the way), try these:
  256.  
  257. > *VT100.Translations:        #override \n\
  258. >         s<Btn4Up>: string("0x1b") string("[64~") \n\
  259. >         s<Btn5Up>: string("0x1b") string("[65~") \n\
  260. >         <Btn4Up>: string("0x1b") string("[62~") \n\
  261. >         <Btn5Up>: string("0x1b") string("[63~")
  262.  
  263. Add these mappings to your vimrc file:
  264. > map <Esc>[62~ <MouseDown>
  265. > map <Esc>[63~ <MouseUp>
  266. > map <Esc>[64~ <S-MouseDown>
  267. > map <Esc>[65~ <S-MouseUp>
  268.  
  269.  vim:tw=78:ts=8:sw=8:
  270.