home *** CD-ROM | disk | FTP | other *** search
/ Black Box 4 / BlackBox.cdr / editors / vi60a1.arj / VIHELP.TXT < prev    next >
Text File  |  1991-12-25  |  22KB  |  429 lines

  1. SECTION A    //////////////////////////////////////////////////////
  2.         / COMMAND REFERENCE FOR OAK HILL VI AND PERSONAL VI* /
  3.         //////////////////////////////////////////////////////
  4. Section
  5. Code    Section Topic        Basic Command Examples
  6. =============================================================================
  7. A ..... Section Code Listing .. (This screen)            
  8. B ..... Legenda ............... Syntax notations    
  9. C ..... Vi Startup ............ vi file[s]   vi +cmd file[s]
  10. D ..... Moving Around ......... h j k l fx Fx tx Tx 1G
  11. E ..... Searching ............. /pat/ ?pat? n N / ? 
  12. F ..... Adding New Text .......    i a o I A O p P
  13. G ..... Deleting Text ......... dd d'a ndd D
  14. H ..... Changing Text ......... c C s S
  15. I ..... Remembering Text ...... yy y'a nyy Y 
  16. J ..... Other Commands ........ :fillp :sh
  17. K ..... Write, Quit, Edit New . :w :e :n :tag ZZ
  18. L ..... Map(!) and Abbrev ..... :map ;s :s/Sam/Bill/
  19. M ..... Setting Options ....... :set noai   :set wm
  20.  
  21. This reference does not show all commands and contains only brief 
  22. descriptions.  Please see manual for details.
  23.  
  24. * Adapted from "Vi Reference" by Maarten Litmaath
  25.  
  26.             
  27.  
  28. SECTION B    ///////////
  29.         / Legenda /
  30.         ///////////
  31.  
  32.     default values          : 1
  33.     <*>                     : `*' must not be taken literally
  34.     [*]                     : `*' is optional
  35.     ^X                      : <ctrl>X
  36.     <sp>                    : space
  37.     <cr>                    : carriage return
  38.     <lf>                    : linefeed
  39.     <ht>                    : horizontal tab
  40.     <esc>                   : escape
  41.     <erase>                 : your erase character
  42.     <intr>                  : your interrupt character
  43.     <a-z>                   : an element in the range
  44.     N                       : number (`*' = allowed, `-' = not appropriate)
  45.     CHAR                    : char that is not <ht> or <sp>
  46.     WORD                    : word that is followed by <ht> or <sp> or <lf>
  47.  
  48.  
  49. SECTION C    //////////////
  50.         / vi startup /
  51.         //////////////
  52.  
  53.     vi [<files>]            | Edit the files, start with the first page of
  54.                             |   the first file.
  55.  
  56.     The editor can be initialized by a single 'colon' command in the
  57.     environment variable `EXINIT', which looks like:
  58.  
  59.             EXINIT='<cmd>'
  60.  
  61.     However, an unlimited list of initializations can also be put into a
  62.     file called EXRC.  This list will override the EXINIT variable.
  63.  
  64.     On-line initializations can be given with `vi +<cmd> file', e.g.:
  65.  
  66.     vi +x file              | The cursor will immediately jump to line x
  67.  
  68.  
  69. SECTION D    /////////////////
  70.         / Moving Around /
  71.         /////////////////
  72.  
  73.      N | Command            | Meaning
  74.     ---+--------------------+-----------------------------------------------
  75.      * | h | ^H             | <*> chars to the left.
  76.      * | j                  | <*> lines downward.
  77.      * | l | <sp>           | <*> chars to the right.
  78.      * | k                  | <*> lines upward.
  79.      * | $                  | To the end of line <*> from the cursor.
  80.      - | ^                  | To the first CHAR of the line.
  81.      * | -                  | To the first CHAR <*> lines higher.
  82.      * | + | <cr>           | To the first CHAR <*> lines lower.
  83.      - | 0                  | To the first char of the line.
  84.      * | |                  | To column <*> 
  85.      * | f<char>            | <*> <char>s to the right (find).
  86.      * | t<char>            | Till before <*> <char>s to the right.
  87.      * | F<char>            | <*> <char>s to the left.
  88.      * | T<char>            | Till after <*> <char>s to the left.
  89.      * | ;                  | Repeat latest `f'|`t'|`F'|`T' <*> times.
  90.      * | ,                  | Same as above but in opposite direction.
  91.      * | w                  | <*> words forward.
  92.      * | W                  | <*> WORDS forward.
  93.      * | b                  | <*> words backward.
  94.      * | B                  | <*> WORDS backward.
  95.      * | e                  | To the end of word <*> forward.
  96.      * | E                  | To the end of WORD <*> forward.
  97.      * | G                  | Go to line <*> (default EOF).
  98.      * | H                  | To line <*> from top of the screen (home).
  99.      * | L                  | To line <*> from bottom of the screen (last).
  100.      - | M                  | To the middle line of the screen.
  101.      * | )                  | <*> sentences forward.
  102.      * | (                  | <*> sentences backward.
  103.      * | }                  | <*> paragraphs forward.
  104.      * | {                  | <*> paragraphs backward.
  105.      - | `<a-z>             | To the mark.
  106.      - | '<a-z>             | To the first CHAR of the line with the mark.
  107.      - | ``                 | To the cursor position before the latest absolute
  108.                             |   jump (of which are examples `/' and `G').
  109.      - | ''                 | To the first CHAR of the line on which the cursor
  110.                             |   was placed before the latest absolute jump.
  111.      - | %                  | To the matching parenthesis or bracket 
  112.  
  113.     ^G                      | Give file name, status, current line number
  114.                             |   and relative position.
  115.     ^L                      | Refresh the screen in case of display corruption
  116.     
  117.     [*]^E                   | Expose <*> more lines at bottom, cursor
  118.                             |   stays put (if possible).
  119.     [*]^Y                   | Expose <*> more lines at top, cursor
  120.                             |   stays put (if possible).
  121.     [*]^D                   | Scroll <*> lines downward
  122.                             |   (default the number of the previous scroll;
  123.                             |   initialization: half a page).
  124.     [*]^U                   | Scroll <*> lines upward
  125.                             |   (default the number of the previous scroll;
  126.                             |   initialization: half a page).
  127.     [*]^F                   | <*> pages forward.
  128.     [*]^B                   | <*> pages backward (in older versions `^B' only
  129.                             |   works without count).
  130.     [*]z<cr>                | Put line <*> at the top of the window
  131.                             |   (default the current line).
  132.     [*]z+                   | Put line <*> at the top of the window
  133.                             |   (default the first line of the next page).
  134.     [*]z-                   | Put line <*> at the bottom of the window
  135.                             |   (default the current line).
  136.     [*]z^                   | Put line <*> at the bottom of the window
  137.                             |   (default the last line of the previous page).
  138.     [*]z.                   | Put line <*> in the centre of the window
  139.                             |   (default the current line).
  140.  
  141.  
  142.  
  143. SECTION E    /////////////
  144.         / Searching /
  145.         /////////////
  146.  
  147.      - | /<string>          | Jump to the next occurrence of <string>.
  148.      - | ?<string>          | Jump to the previous occurrence of <string>.
  149.      - | n                  | Repeat latest `/' or `?' command
  150.      - | N                  | Same as above but search in opposite direction.
  151.      
  152.     :ta <name>              | Search in the tags file where <name> is
  153.                             |   defined (file, line), and go to it.
  154.     ^]                      | Use the name under the cursor in a `:ta' command.
  155.  
  156.  
  157. SECTION F    ////////////////////////////////////
  158.         / Adding New Text (end with <esc>) /
  159.         ////////////////////////////////////
  160.  
  161.      - | <esc>            | Exit append mode, return to command mode
  162.      - | u            | Undo the latest text change command
  163.      
  164.      - | a                  | <*> times after the cursor.
  165.      - | A                  | <*> times at the end of line.
  166.      - | i                  | <*> times before the cursor (insert).
  167.      - | I                  | <*> times before the first CHAR of the line
  168.      - | o                  | On a new line below the current (open).
  169.                             |   The count is only useful on a slow terminal.
  170.      - | O                  | On a new line above the current.
  171.                             |   The count is only useful on a slow terminal.
  172.      * | >'a                | Shift the lines from the current line to the
  173.                             |   line marked 'a' one shiftwidth to the right.
  174.      * | >>                 | Shift <*> lines one shiftwidth to the right.
  175.      - | ["<a-z>]p          | Put the contents of the (default undo) buffer
  176.                             |   after the cursor.
  177.                             |   A buffer containing lines is put below 
  178.                             |   the current line.
  179.      - | ["<a-z>]P          | Put the contents of the (default undo) buffer
  180.                             |   <*> times before the cursor.
  181.                             |   A buffer containing lines is put only once,
  182.                             |   above the current line.
  183.      - | .                  | Repeat previous text change command.
  184.  
  185.                     | Special commands while in append mode:
  186.     ^V                      | Deprive the next char of its special meaning
  187.                             |   (e.g. <esc>).
  188.     ^D                      | One shiftwidth to the left.
  189.     ^H | <backspace>        | One char back.
  190.     ^W                      | One word back.
  191.  
  192.  
  193.  
  194. SECTION G    /////////////////
  195.         / Deleting Text /
  196.         /////////////////
  197.  
  198.     Everything deleted can be stored into a buffer. This is achieved by
  199.     putting a `"' and a letter <a-z> before the delete command. The
  200.     deleted text will be in the buffer with the used letter. 
  201.  
  202.      * | x                  | Delete <*> chars under and after the cursor.
  203.      * | X                  | Delete <*> chars before the cursor.
  204.      * | d<move>            | From begin to endpoint of <*><move>.
  205.      * | dd                 | Delete <*> lines.
  206.      - | D                  | The rest of the line.
  207.      - | <'x                | Shift the lines from the current line to the
  208.                             |   line marked 'x' one shiftwidth to the left.
  209.      * | <<                 | Shift <*> lines one shiftwidth to the left.
  210.      * | .                  | Repeat latest command <*> times.
  211.      
  212.      === EXAMPLES ===
  213.      
  214.      4dd    Deletes 4 lines
  215.      d'a    Deletes lines from current line to the one marked 'a'
  216.      de        Deletes to end of current word
  217.      dE        Deletes to end of current WORD
  218.  
  219.  
  220. SECTION H    //////////////////////////////////
  221.         / Changing Text (end with <esc>) /
  222.         //////////////////////////////////
  223.  
  224.      - | r<char>            | Replace current char by <char> - no <esc>.
  225.      - | R                  | Overwrite the current line
  226.      * | s                  | Substitute <*> chars.
  227.      * | S                  | Substitute <*> lines.
  228.      * | c<move>            | Change from begin to endpoint of <*><move>.
  229.      * | cc                 | Change <*> lines.
  230.      * | C                  | The rest of the line and <*> - 1 next lines.
  231.      - | ~                  | Switch lower and upper case for current character
  232.      - | J                  | Join 2 lines 
  233.      - | .                  | Repeat latest text change command 
  234.      - | &                  | Repeat latest `ex' substitute command, e.g.
  235.                             |   `:s/wrong/good' for current line only
  236.      - | :[x,y]s/<p>/<r>/<f>| Substitute (on lines x through y) the pattern <p>
  237.                             |   (default the last pattern) with <r>.  Useful
  238.                             |   flag <f> is `g' for `global' (i.e. change
  239.                             |   every non-overlapping occurrence of <p>)
  240.  
  241.  
  242. SECTION I    //////////////////////////////
  243.         / Remembering Text (Yanking) /
  244.         //////////////////////////////
  245.  
  246.     With yank commands you can put `"<a-z>' before the command, just as
  247.     with delete commands.  Otherwise you only copy to the undo buffer.
  248.     The use of buffers <a-z> is THE way of copying text to another file;
  249.     see the `:e <file>' command.
  250.  
  251.      * | y<move>            | Yank from begin to endpoint of <*><move>.
  252.      * | yy                 | <*> lines.
  253.      * | Y                  | Same as above
  254.      - | m<a-z>             | Mark cursor position with letter from 'a' to 'z'.
  255.  
  256.  
  257. SECTION J    //////////////////////////////////
  258.         / Substitutions & Other Commands /
  259.         //////////////////////////////////
  260.  
  261.     
  262.     :sh                     | Execute a subshell, back to vi with <cr>
  263.                     | 
  264.     :fillp            | Fill ("format") the text in the paragraph
  265.                     |  in which the cursor sits.  A "paragraph"
  266.                     |  is a section of text delimited by blank
  267.                     |  lines or lines that begin with a period.
  268.     :rfillp            | Same as above, but each sentence begins
  269.                     |  on a new line.
  270.                     |
  271.     !<addr><cmd>            | The shell executes <cmd>, with as standard
  272.                             |   input the lines delimited by the current
  273.                             |   line and the line <addr>.  Typically <addr>
  274.                             |    is a line marked with an address like 'a.
  275.     :r <name>               | Read the file <name> into the buffer.
  276.  
  277.  
  278. SECTION K    /////////////////////////////////////////////////
  279.         / Writing, Editing Other Files, and Quitting Vi /
  280.         /////////////////////////////////////////////////
  281.  
  282.     In `:' `ex' commands `%' denotes the current file, `#' is a synonym for
  283.     the alternate file (which normally is the previous file).
  284.     Marks can be used for line numbers too: '<a-z>.
  285.     In the `:w'|`:f'|`:cd'|`:e'|`:n' commands shell meta-characters can be
  286.     used.
  287.  
  288.     :q                      | Quit vi, unless the buffer has been changed.
  289.     :q!                     | Quit vi without writing.
  290.     :w                      | Write the file.
  291.     :w <name>               | Write to the file <name>.
  292.     :we <name>              | Write current file and edit file <name>.
  293.     :w >> <name>            | Append the buffer to the file <name>.
  294.     :w! <name>              | Overwrite the file <name>.
  295.     :x,y w <name>           | Write lines x through y to the file <name>.
  296.     :wq                     | Write the file and quit vi; 
  297.     ZZ                      | Write if the buffer has been changed, and
  298.                             |   quit vi.  
  299.     :x [<file>]             | Same as above [but write to <file>].
  300.     :x! [<file>]            | `:w![<file>]' and `:q'.
  301.     :f <name>               | Set the current filename to <name>.
  302.     :e [+<cmd>] <file>      | Edit another file without quitting vi - the
  303.                             |   buffers are not changed (except the undo
  304.                             |   buffer), so text can be copied from one file to
  305.                             |   another this way.  [Execute the `ex' command
  306.                             |   <cmd> (default `$') when the new file has been
  307.                             |   read into the buffer.]  <cmd> must contain no
  308.                             |   <sp> or <ht>.  See `vi startup'.
  309.     :e! [+<cmd>] <file>     | Same as above, without writing the current buffer.
  310.     ^^                      | Edit the alternate (normally the previous) file.
  311.     :rew                    | Rewind the argument list, edit the first file.
  312.     :rew!                   | Idem, without writing the current buffer.
  313.     :n [+<cmd>] [<files>]   | Edit next file or specify a new argument list.
  314.     :n! [+<cmd>] [<files>]  | Idem, without writing the current buffer.
  315.     :args                   | Give the argument list, with the current file
  316.                             |   between `[' and `]'.
  317.  
  318.  
  319. SECTION L    ////////////////////////////
  320.         / Mapping and Abbreviation /
  321.         ////////////////////////////
  322.  
  323.     When mapping take a look at the options `to' and `remap' (below).
  324.  
  325.     :map <string> <seq>     | <string> is interpreted as <seq> as if the
  326.                     |   commands in <seq> had been entered from the
  327.                     |   keyboard
  328.     :map                    | Show all mappings.
  329.     :unmap <string>         | Deprive <string> of its mapping.  
  330.                     |
  331.     :map! <string> <seq>    | <string> is interpreted as if <seq> had been
  332.                     |   entered in input mode, that is, the 
  333.                     |   characters in <string> will be instantly
  334.                     |   replaced by <seq>
  335.     :map!                   | Show all input mode mappings.
  336.     :unmap! <string>        | Deprive <string> of its mapping (see `:unmap').
  337.                         |
  338.     :ab <string> <seq>      | Whenever in input mode <string> is preceded and
  339.                             |   followed by space or punctuation, <string>
  340.                             |   is replaced by <seq>.
  341.     :ab                     | Show all abbreviations.
  342.     :unab <string>          | Do not consider <string> an abbreviation
  343.                             |   anymore (see `:unmap').
  344.                             |
  345.     @<a-z>                  | Consider the contents of the named register a
  346.                             |   command, e.g.:
  347.                             |       o:s/wrong/good/<esc>"ayy
  348.                             |   Explanation:
  349.                             |       o              - open a new line
  350.                             |       :s/wrong/good/ - this input text is an
  351.                             |                        `ex' substitute command
  352.                             |       <esc>          - finish the input
  353.                             |       "add           - yank the line just
  354.                             |                        created into register `a'
  355.                             |   Now you can type `@a' to replace `wrong'
  356.                             |   with `good' on the current line.
  357.     @@                      | Repeat last register command.
  358.  
  359.  
  360. SECTION M    //////////////////////////////
  361.         / The Most Important Options /
  362.         //////////////////////////////
  363.  
  364.     :set                    | Show all options and their values.
  365.     :set all                | Show all options and their values.
  366.                     |
  367.     :set ai                 | autoindent - In append mode after a <cr> the
  368.     :set noai             |   cursor will move directly below the first
  369.                             |   CHAR on the previous line.  However, if the
  370.                             |   option `lisp' is set, the cursor will align
  371.                             |   at the first argument to the last open list.
  372.                             |
  373.     :set aw                 | autowrite - Write at every shell escape
  374.     :set noaw               | noautowrite - do not write at every shell escape
  375.                     |
  376.     :set beep               | Audibly beeps when you goof
  377.     :set nobeep             | Visually flashes "BEEP" when you goof
  378.                             |   (not on every terminal).
  379.                             |
  380.     :set colors=[bright] foreground [on] background
  381.                     | Sets screen colors.  "foreground" & "background"
  382.                     |   may be black, red, green, yellow, blue, 
  383.                     |   magenta, cyan, or white.  The "bright" modifier
  384.                     |   is optional.  Recommended selections are
  385.                     |   bright white on blue or bright yellow on 
  386.                     |   yellow.
  387.                             |
  388.     :set cursor=underscore  | Set cursor to flashing underscore or flashing
  389.     :set cursor=box         |   box.  Choosing "inbox" will produce underscore
  390.     :set cursor=inbox       |   in command mode and flashing box in input mode.
  391.                     |
  392.     :set ic                 | ignorecase - No distinction between upper and
  393.     :set noic            |   lower cases when searching.
  394.                     |
  395.     :set magic              | If this option is set (default), the chars `.',
  396.     :set nomagic            |   `[' and `*' have special meanings within search
  397.                             |   and `ex' substitute commands.  To deprive such
  398.                             |   a char of its special function it must be
  399.                             |   preceded by a `\'.  If the option is turned off
  400.                             |   it's just the other way around.  Meta-chars:
  401.                             |   ^<string>    - <string> must begin the line
  402.                             |   <string>$    - <string> must end the line
  403.                             |   .            - matches any char
  404.                             |   [a-z]        - matches any char in the range
  405.                             |   [^a-z]       - any char not in the range
  406.                             |   [<string>]   - matches any char in <string>
  407.                             |   [^<string>]  - any char not in <string>
  408.                             |   <char>*      - 0 or more <char>s
  409.     :set nu                 | Show line numbers with each line
  410.     :set nonu            | Do not show line numbers with each line
  411.                     |
  412.     :set rmar=n             | Set right margin for text filling.
  413.                     |
  414.     :set sect=<string>      | sections - Gives the section delimiters (for `[['
  415.                             |   and `]]'); see option `para'. A `{' beginning a
  416.                             |   line also starts a section (as in C functions).
  417.     :set ts=<*>             | tabstop - The length of a <ht>; warning: this is
  418.                             |   only IN the editor, outside of it <ht>s have
  419.                             |   their normal length (default 8 positions).
  420.     :set wm=<*>             | wrapmargin - In append mode vi automatically
  421.                             |   puts a <lf> whenever there is a <sp> or <ht>
  422.                             |   within <wm> columns from the right margin
  423.                             |   (0 = don't put a <lf> in the file, yet put it
  424.                             |   on the screen).
  425.     :set ws                 | wrapscan - When searching, wrap around from
  426.                     |    end of file back to the beginning
  427.     :set nows               | do not wrap when searching
  428.                 |
  429.