home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 8 / FreshFishVol8-CD1.bin / useful / util / edit / vim / doc / difference.doc < prev    next >
Text File  |  1994-08-09  |  21KB  |  493 lines

  1.  
  2.  
  3. This is a summary of the differences between VIM and vi. It is not complete.
  4. see also reference.doc and look for comments in {}.
  5.  
  6.  
  7. The most interesting additions:
  8.  
  9. Vi compatibility.
  10. When the 'compatible' option is set, all options are given a vi-compatible
  11. value. Vim will behave like the "real" vi as much as possible.
  12.  
  13.  
  14. Multi level undo.
  15. 'u' goes backward in time, 'ctrl-R' goes forward again. Set option 
  16. 'undolines' to the number of changes to be remembered (default 100). Set 
  17. 'undolines' to 0 for vi-compatible one level undo.
  18.  
  19. When all changes in a buffer have been undone, the buffer is not considered
  20. changed anymore. You can exit it with :q, without <!>.
  21.  
  22.  
  23. Multiple windows and buffers.
  24. Vim can split the screen into several windows, each editing a different
  25. buffer or the same buffer at a different location. Buffers can still be
  26. loaded (and changed) but not displayed in a window. This is called a hidden
  27. buffer. Many commands and options have been added for this facility, see
  28. windows.doc.
  29.  
  30.  
  31. Repeat a series of commands.
  32. 'q'<c> starts recording typed characters into named register <c> (append to
  33. the register if register name is upper case). A subsequent 'q' stops
  34. recording. The register can then be executed with the '@'<c> command. This is
  35. very useful to repeat a complex action.
  36.  
  37.  
  38. Flexible insert mode.
  39. The arrow keys can be used in insert mode to move around in the file. This 
  40. breaks the insert in two parts as far as undo and redo is concerned.
  41.  
  42. CTRL-O can be used to execute a single command-mode command. This is almost 
  43. the same as hitting ESC, typing the command and hitting 'a'. For undo/redo 
  44. only those inserts are remembered where something was actually inserted.
  45.  
  46.  
  47. Visual mode.
  48. Visual can be used to first choose a piece of text and then give a command 
  49. to do something with it. This is an (easy to use) alternative to first giving 
  50. the operator and then moving to the end of the text to be operated upon. 'v' 
  51. and 'V' are used to start Visual mode. 'v' works on characters and 'V' on
  52. lines. Move the cursor to extend the Visual part. It is shown highlighted on
  53. the screen. By typing 'o' the other end of the Visual text can be moved. The
  54. Visual text can be affected by an operator:
  55.     d    delete
  56.     c    change
  57.     y    yank
  58.     > or <    insert or delete indent
  59.     !    filter through external program
  60.     =    filter through indent
  61.     :    start ":" command for the Visual lines.
  62.     Q    format text to 'textwidth' columns
  63.     J    join lines
  64.     ~    swap case
  65.     u    make lowercase
  66.     U    make uppercase
  67.  
  68.  
  69. Block operators.
  70. With Visual a rectangular block of text can be selected. Start Visual with 
  71. CTRL-V. The block can be deleted ('d'), yanked ('y') or its case can be 
  72. changed ('~', 'u' and 'U'). A deleted or yanked block can be put into the
  73. text with the 'p' and 'P' commands.
  74.  
  75.  
  76. Online help.
  77. ':help' command and help key (F1 for MSDOS) display several pages of concise 
  78. help. The name of the help file can be set with the "helpfile" option.
  79.  
  80.  
  81. Command line editing.
  82. You can insert or delete at any place in the command line using the cursor 
  83. keys. The right/left cursor keys can be used to move forward/backward one 
  84. character. The shifted right/left cursor keys can be used to move 
  85. forward/backward one word. CTRL-B/CTRL-E can be used to go to the begin/end
  86. of the command line.
  87.  
  88. The command lines are remembered. The up/down cursor keys can be used to 
  89. recall previous command lines. The 'history' option can be set to the number 
  90. of lines that will be remembered.
  91.  
  92.  
  93. Command line completion.
  94. While entering a command line (on the bottom line of the screen) <TAB> can be 
  95. typed to complete
  96.    what        example        where
  97. - a command    :e<TAB>        at start of command line
  98. - a tag        :ta no<TAB>    after :ta
  99. - an option    :set sc<TAB>    after :set
  100. - a filename    :e v<TAB>    after any command that accepts a filename
  101.  
  102. If there are multiple matches, CTRL-N (next) and CTRL-P (previous) will walk
  103. through the matches. <TAB> works line CTRL-N, but wraps around to the first
  104. match.
  105.  
  106. The 'wildchar' option can be set to the character for command line
  107. completion, <TAB> is the default. CTRL-D can be typed after an (incomplete)
  108. wildcard; all matches will be listed. CTRL-A will insert all matches.
  109. CTRL-L will insert the longest common part of the matches.
  110.  
  111.  
  112. Horizontal scrolling.
  113. If the 'wrap' option is off, long lines will not wrap and only part of them
  114. will be shown. When the cursor is moved to a part that is not shown, the
  115. screen will scroll horizontally. The minimal number of columns to scroll can
  116. be set with the 'sidescroll' option.
  117.  
  118.  
  119. Text formatting.
  120. The 'textwidth' (tw) option can be used to automatically limit the line 
  121. length. This supplements the 'wrapmargin' option of Vi, which was not very 
  122. useful. The 'Q' operator can be used to format a piece of text ("Q}" formats 
  123. a paragraph). Commands for text alignment: ":center", ":left" and ":right".
  124.  
  125.  
  126. Edit-compile-edit speedup.
  127. The ":make" command can be used to run the compilation and jump to the first
  128. error. Alternatively Vim can be started with the "-e" option from the
  129. compiler. A file with compiler error messages is interpreted. Each line in
  130. the error file is scanned for the name of a file, line number and error
  131. message. Vim starts editing at the first error. Optionally the name of the
  132. error file can be given with "-e errorfile". The ":cn" command can be used to
  133. jump to the next error. ":cl" lists all the error messages. Other commands
  134. are available (almost the same as with Manx's Z editor). The 'errorfile'
  135. option has the name of the file with error messages. The 'errorformat' option
  136. can be set to a scanf-like string to handle output from many compilers. The
  137. 'makeprg' option contains the name of the program to be executed with the
  138. ":make" command. The 'shellpipe' option contains the string to be used to put
  139. the output of the compiler into the errorfile.
  140.  
  141.  
  142. Command line options:
  143.  
  144. When Vim is started with "-v" (View) then readonly mode is used (includes 
  145. "-n").
  146.  
  147. When Vim is started with "-b" (Binary) then some options are set to be able
  148. to edit binary or executable files.
  149.  
  150. When Vim is started with "-s scriptfile", the characters read from 
  151. "scriptfile" are treated as if you typed them. If end of file is reached 
  152. before the editor exits, further characters are read from the console.
  153.  
  154. The "-w" option can be used to record all typed characters in a script file. 
  155. This file can then be used to redo the editing, possibly on another file or 
  156. after changing some commands in the script file.
  157.  
  158. The "-n" option disables the writing of a ".swp" file (see below).
  159.  
  160. The "-c command" option does the same as the the "+command" option.
  161.  
  162. The "-T terminal" option sets the terminal type.
  163.  
  164. The "-e" option starts Vim in quickfix mode.
  165.  
  166. The "-o" option opens a window for each argument. "-o4" opens four windows.
  167.  
  168.  
  169. In command mode:
  170.  
  171. Missing command: 'Q' (go to Ex mode).
  172. Missing Ex commands: append, change, insert, open, recover and z.
  173.  
  174. The command characters are shown in the last line of the screen. They are 
  175. removed when the command is finished. If you do not want this (on a slow 
  176. terminal) reset the 'showcmd' option.
  177.  
  178. If the 'ruler' option is set, the current cursor position is shown in the 
  179. last line of the screen.
  180.  
  181. 'u' and CTRL-R accept a count for the number of undos/redos.
  182.  
  183. 'U' still works after having moved off of the last changed line and after 
  184. 'u'.
  185.  
  186. Nulls in the file are replaced by <LF> internally. This allows editing of 
  187. binary files (more or less).
  188.  
  189. Characters with the 8th bit set are displayed. The characters between '~' and 
  190. 0xa0 are displayed as "~?", "~@", "~A", etc., unless the "graphic' option is 
  191. set.
  192.  
  193. '=' is an operator to filter lines through an external command (vi: lisp 
  194. stuff). The name of the command can be set with the 'equalprg' option. The 
  195. default is "indent".
  196.  
  197. '][' goes to the next ending of a C function ('}' in column 1).
  198. '[]' goes to the previous ending of a C function ('}' in column 1).
  199.  
  200. ']f', '[f' and 'gf' start editing the file whose name is under the cursor.
  201. CTRL-W f splits the window and starts editint the file whose name is under
  202. the cursor.
  203.  
  204. '*' searches forward for the identifier under the cursor, '#' backward.
  205. 'K' runs the program defined by the "keywordprg" option, with the identifier 
  206. under t