home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 8 / FreshFishVol8-CD2.bin / bbs / util / vim-3.0.lha / Vim / doc / windows.doc < prev    next >
Text File  |  1994-08-12  |  15KB  |  435 lines

  1. Editing with multiple windows and buffers.
  2.  
  3. Explained here are commands have been added to use multiple windows and
  4. buffers. Additionally there are explanations for commands that work different
  5. when used in combination with more than one window.
  6.  
  7.  
  8. A window is a viewport onto a buffer. You can use multiple windows on one
  9. buffer. Or several windows on different buffers.
  10.  
  11. A buffer is a file loaded into memory for editing. The original file remains
  12. unchanged until you write the buffer to the file.
  13.  
  14. A buffer can be in one of three states:
  15.  
  16. active:   The buffer is displayed in a window. If there is a file for this
  17.       buffer it has been read into the buffer. The buffer may have been
  18.       modified.
  19. hidden:   The buffer is not displayed. If there is a file for this buffer it
  20.           has been read into the buffer. The buffer may have been modified.
  21. inactive: The buffer is not displayed and does not contain anything. Options
  22.           for the buffer are remembered if the file was once loaded.
  23.  
  24. In a table:
  25.  
  26. state        displayed    loaded        :buffers
  27.         in window             shows
  28. active          yes         yes          ' '
  29. hidden          no         yes          'h'
  30. inactive      no         no          '-'
  31.  
  32.  
  33. Starting Vim
  34. -----------
  35.  
  36. By default Vim starts with one window, just like vi.
  37.  
  38. The "-o" command line argument can be used to open a window for each file in
  39. the argument list: "Vim -o file1 file2 file3" will open three windows.
  40.  
  41. "-oN", where N is a decimal number, opens N windows. If there are more file
  42. names than windows, only N windows are opened, some files do not get a window.
  43. If there are more windows than file names, the last few windows will be
  44. editing empty buffers.
  45.  
  46. If there are many file names the windows will become very small. You might
  47. want to set the 'winheight' option to create a workable situation.
  48.  
  49.  
  50. Opening a new window
  51. --------------------
  52.  
  53. CTRL-W s
  54. CTRL-W S
  55. CTRL-W CTRL-S
  56. :[N]split
  57.         Split current window in two. The result is two viewports on
  58.         the same file. Make new window N high (default is to use half
  59.         the height of the current window). Reduces the current window
  60.         height to create room (and others, if the 'equalalways' option
  61.         is set).
  62.  
  63. CTRL-W n
  64. CTRL-W CTRL_N
  65. :[N]new
  66.         Create a new window and start editing an empty file in it.
  67.         Make new window N high (default is to use half the existing
  68.         height). Reduces the current window height to create room (and
  69.         others, if the 'equalalways' option is set). 
  70.  
  71. :[N]new [+command] fname
  72. :[N]split [+command] fname
  73.         Create a new window and start editing file fname in it. If
  74.         [+command] is given, execute the command when the file has
  75.         been loaded. Make new window N high (default is to use half
  76.         the existing height). Reduces the current window height to
  77.         create room (and others, if the 'equalalways' option is set).
  78.  
  79.  
  80. Closing a window
  81. ----------------
  82.  
  83. CTRL-W q
  84. CTRL-W CTRL-Q
  85. :quit        Quit current window, unless the buffer was changed and there
  86.         are no other windows for this buffer. When quitting the last
  87.         window, exit Vim.
  88.  
  89. :quit!        Quit current window. If this was the last window for a buffer,
  90.         any changes to that buffer are lost. When quitting the last
  91.         window, exit Vim. 
  92.  
  93. CTRL-W c
  94. :close        Quit current window, unless it is the last window on the
  95.         screen. The buffer becomes hidden (unless there is another
  96.         window editing it). (Note: CTRL-W CTRL-C does not work).
  97.  
  98. CTRL-W o
  99. CTRL-W CTRL-O
  100. :only        Make the current window the only one on the screen. All other
  101.         windows are closed. All buffers in the other windows become
  102.         hidden.
  103.  
  104.  
  105. Moving the cursor to other windows
  106. ----------------------------------
  107.  
  108. CTRL-W <CURSOR_DOWN>
  109. CTRL-W CTRL-J
  110. CTRL-W j    move cursor to Nth window below current one.
  111.  
  112. CTRL-W <CURSOR_UP>
  113. CTRL-W CTRL-K
  114. CTRL-W k    move cursor to Nth window above current one.
  115.  
  116. CTRL-W w
  117. CTRL-W CTRL-W    Without count: move cursor to window below current one. If
  118.         there is no window below, go to upper window.
  119.         With count: go to Nth window.
  120.  
  121. CTRL-W p
  122. CTRL-W CTRL-P    go to previous (last accessed) window.
  123.  
  124.  
  125. Moving windows around
  126. ---------------------
  127.  
  128. CTRL-W r
  129. CTRL-W CTRL-R    Rotate windows downwards. The first window becomes the second
  130.         one, the second one the third one, etc. The last window
  131.         becomes the first window. The cursor remains in the same
  132.         window.
  133.  
  134. CTRL-W R    Rotate windows upwards. The second window becomes the first
  135.         one, the third one the second one, etc. The first window
  136.         becomes the last window. The cursor remains in the same
  137.         window.
  138.  
  139. CTRL-W x
  140. CTRL-W CTRL-X    Without count: Exchange current window with next one. If there
  141.         is no next window, exchange with previous window. With count:
  142.         Exchange current window with Nth window (first window is 1).
  143.         The cursor is put in the other window.
  144.  
  145.  
  146. Window resizing
  147. ---------------
  148.  
  149. CTRL-W =    make all windows (almost) equal high.
  150.  
  151. :resize -N
  152. CTRL-W -    decrease current window height by N
  153.  
  154. :resize +N
  155. CTRL-W +    increase current window height by N
  156.  
  157. :resize [N]
  158. CTRL-W CTRL-_
  159. CTRL-W _    set current window height to N (default: highest possible)
  160.  
  161. z<nr><CR>    set current window height to nr
  162.  
  163. The option 'winheight' ('wh') is used to set the minimal window height of the
  164. current window. This option is used each time another window becomes the
  165. current window. If the option is '0' it is disabled. Set 'winheight' to a very
  166. large value, e.g. '9999', to make the current window always fill all available
  167. space. Set it to a reasonable value, e.g. '10', to make editing in the current
  168. window comfortable.
  169.  
  170. When the option 'equalalways' ('ea') is set all the windows are automatically
  171. made the same size after splitting or closing a window. If you don't set this
  172. option, splitting a window will reduce the size of the current window and
  173. leave the other windows the same. When closing a window the extra lines are
  174. given the the window above it.
  175.  
  176. The option 'commandheight' ('ch') is used to set the height of the command
  177. line. If you are annoyed by the "hit return to continue" questions for long
  178. messages, set this option to 2 or 3.
  179.  
  180. If there is only one window, resizing that window will also change the command
  181. line height. If there are several windows, resizing the current window will
  182. also change the height of the window below it (and sometimes the window above
  183. it).
  184.  
  185.  
  186. Exiting Vim with multiple windows or buffers
  187. --------------------------------------------
  188.  
  189. :qall        Exit Vim, unless there are some buffers which have been
  190.         changed. (Use :bmod to go to the next modified buffer).
  191.  
  192. :qall!        Exit Vim. Any changes to buffers are lost.
  193.  
  194. :wqall
  195. :xall        Write all changed buffers and exit Vim. If there are buffers
  196.         without a file name, which are readonly or cannot be written
  197.         for another reason, Vim is not quit. 
  198.  
  199. :wqall!
  200. :xall!        Write all changed buffers, also the ones that are readonly,
  201.         and exit Vim. If there are buffers without a file name or
  202.         cannot be written for another reason, Vim is not quit. 
  203.  
  204.  
  205. Writing with multiple buffers
  206. -----------------------------
  207.  
  208. :wall        Write all changed buffers. Buffers without a file name or
  209.         which are readonly are not written.
  210.  
  211. :wall!        Write all changed buffers, also the ones that are readonly.
  212.         Buffers without a file name are not written.
  213.  
  214.  
  215. Overview of argument and buffer list commands
  216. ---------------------------------------------
  217.  
  218.    args list            buffer list        meaning
  219. 1. :[N]argument [N]    11. :[N]buffer [N]    to arg/buf N
  220. 2. :[N]next [file ..]    12. :[N]bnext [N]    to Nth next arg/buf
  221. 3. :[N]Next [N]        13. :[N]bNext [N]    to Nth previous arg/buf
  222. 4. :[N]previous    [N]    14. :[N]bprevious [N]    to Nth previous arg/buf
  223. 5. :rewind        15. :brewind        to first arg/buf
  224. 6. :last        16. :blast        to last arg/buf
  225. 7. :all            17. :ball        edit all args/buffers
  226.             18. :unhide        edit all loaded buffers
  227.             19. :[N]bmod [N]    to Nth modified buf
  228.  
  229.  split & args list      split & buffer list     meaning                   
  230. 21. :[N]sargument [N]   31. :[N]sbuffer [N]    split + to arg/buf N           
  231. 22. :[N]snext [file ..] 32. :[N]sbnext [N]      split + to Nth next arg/buf    
  232. 23. :[N]sNext [N]       33. :[N]sbNext [N]      split + to Nth previous arg/buf
  233. 24. :[N]sprevious [N]   34. :[N]sbprevious [N]  split + to Nth previous arg/buf
  234. 25. :srewind            35. :sbrewind           split + to first arg/buf       
  235. 26. :slast              36. :sblast             split +