home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 4 / DATAFILE_PDCD4.iso / unix / riscbsd / datafile / usd / 15_vi / vi_apwh_ms next >
Encoding:
Text File  |  1996-10-12  |  47.0 KB  |  1,387 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.               Vi Command & Function Reference
  11.  
  12.                       Alan P.W. Hewett
  13.  
  14.           Revised for version 2.12 by Mark Horton
  15.  
  16.  
  17. 1.  Author's Disclaimer
  18.  
  19. This document does not claim to be 100% complete.  There are
  20. a few commands listed in the original document  that  I  was
  21. unable  to  test either because I do not speak lisp, because
  22. they required programs we don't have, or  because  I  wasn't
  23. able  to  make them work.  In these cases I left the command
  24. out.  The commands listed in this document have  been  tried
  25. and  are  known  to  work.   It is expected that prospective
  26. users of this document will read it once to get  the  flavor
  27. of  everything that vi can do and then use it as a reference
  28. document.  Experimentation is  recommended.   If  you  don't
  29. understand a command, try it and see what happens.
  30.  
  31. [Note:  In  revising this document, I have attempted to make
  32. it completely reflect version  2.12  of  vi.   It  does  not
  33. attempt  to  document  the VAX version (version 3), but with
  34. one or two exceptions (wrapmargin,  arrow  keys)  everything
  35. said about 2.12 should apply to 3.1.  Mark Horton]
  36.  
  37. 2.  Notation
  38.  
  39. [option]  is  used  to  denote  optional parts of a command.
  40. Many vi commands have an optional count.  [cnt]  means  that
  41. an  optional  number  may precede the command to multiply or
  42. iterate the command.  {variable  item}  is  used  to  denote
  43. parts  of the command which must appear, but can take a num-
  44. ber of different  values.   <character  [-character]>  means
  45. that  the  character  or  one of the characters in the range
  46. described between the two angle brackets  is  to  be  typed.
  47. For  example <esc> means the escape key is to be typed.  <a-
  48. z> means that a lower case letter is to be typed.  ^<charac-
  49. ter>  means  that  the character is to be typed as a control
  50. character, that is, with the  <cntl>  key  held  down  while
  51. simultaneously typing the specified character.  In this doc-
  52. ument control characters will be  denoted  using  the  upper
  53. case  character,  but  ^<uppercase chr> and ^<lowercase chr>
  54. are equivalent.  That is, for  example,  <^D>  is  equal  to
  55. <^d>.   The most common character abbreviations used in this
  56. list are as follows:
  57.  
  58. <esc>   escape, octal 033
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.                              -2-
  71.  
  72.  
  73. <cr>    carriage return, ^M, octal 015
  74.  
  75. <lf>    linefeed ^J, octal 012
  76.  
  77. <nl>    newline, ^J, octal 012 (same as linefeed)
  78.  
  79. <bs>    backspace, ^H, octal 010
  80.  
  81. <tab>   tab, ^I, octal 011
  82.  
  83. <bell>  bell, ^G, octal 07
  84.  
  85. <ff>    formfeed, ^L, octal 014
  86.  
  87. <sp>    space, octal 040
  88.  
  89. <del>   delete, octal 0177
  90.  
  91.  
  92. 3.  Basics
  93.  
  94. To run vi the  shell  variable  TERM  must  be  defined  and
  95. exported  to  your  environment.  How you do this depends on
  96. which shell you are using.  You can  tell  which  shell  you
  97. have by the character it prompts you for commands with.  The
  98. Bourne shell prompts with `$', and the C shell prompts  with
  99. `%'.  For these examples, we will suppose that you are using
  100. an HP 2621 terminal, whose termcap name is ``2621''.
  101.  
  102. 3.1.  Bourne Shell
  103.  
  104. To manually set your terminal type to 2621 you would type:
  105.  
  106.      TERM=2621
  107.      export TERM
  108.  
  109.  
  110.      There are various ways of having this automatically  or
  111. semi-automatically  done  when you log in.  Suppose you usu-
  112. ally dial in on a 2621.   You  want  to  tell  this  to  the
  113. machine,  but  still  have  it work when you use a hardwired
  114. terminal.  The recommended way, if you have  the  tset  pro-
  115. gram, is to use the sequence
  116.  
  117.      tset -s -d 2621 > tset$$
  118.      . tset$$
  119.      rm tset$$
  120.  
  121. in your .login (for csh) or the same thing using `.' instead
  122. of `source' in your .profile (for sh).  The above line  says
  123. that if you are dialing in you are on a 2621, but if you are
  124. on a hardwired terminal it figures out  your  terminal  type
  125. from an on-line list.
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.                              -3-
  137.  
  138.  
  139. 3.2.  The C Shell
  140.  
  141. To manually set your terminal type to 2621 you would type:
  142.  
  143.      setenv TERM 2621
  144.  
  145.  
  146.      There  are various ways of having this automatically or
  147. semi-automatically done when you log in.  Suppose  you  usu-
  148. ally  dial  in  on  a  2621.   You  want to tell this to the
  149. machine, but still have it work when  you  use  a  hardwired
  150. terminal.   The  recommended  way, if you have the tset pro-
  151. gram, is to use the sequence
  152.  
  153.      tset -s -d 2621 > tset$$
  154.      source tset$$
  155.      rm tset$$
  156.  
  157. in your .login.*  The above line says that if you are  dial-
  158. ing in you are on a 2621, but if you are on a hardwired ter-
  159. minal it figures out your  terminal  type  from  an  on-line
  160. list.
  161.  
  162. 4.  Normal Commands
  163.  
  164. Vi  is  a visual editor with a window on the file.  What you
  165. see on the screen is vi's current notion of what  your  file
  166. will  contain, (at this point in the file), when it is writ-
  167. ten out.  Most commands do  not  cause  any  change  in  the
  168. screen  until the complete command is typed.  Should you get
  169. confused while typing a command, you can abort  the  command
  170. by typing an <del> character.  You will know you are back to
  171. command level when you hear a  <bell>.   Usually  typing  an
  172. <esc> will produce the same result.  When vi gets an improp-
  173. erly formatted command it rings the <bell>.   Following  are
  174. the vi commands broken down by function.
  175.  
  176. 4.1.  Entry and Exit
  177.  
  178. To enter vi on a particular file, type
  179.  
  180.      vi file
  181.  
  182. The  file  will  be read in and the cursor will be placed at
  183. the beginning of the first line.  The  first  screenfull  of
  184. the file will be displayed on the terminal.
  185.  
  186.      To get out of the editor, type
  187.  
  188.  
  189. -----------
  190. * On a version 6 system without environments,  the
  191. invocation  of  tset is simpler, just add the line
  192. ``tset -d 2621'' to your .login or .profile.
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.                              -4-
  203.  
  204.  
  205.      ZZ
  206.  
  207. If  you  are in some special mode, such as input mode or the
  208. middle of a multi-keystroke command, it may be necessary  to
  209. type <esc> first.
  210.  
  211. 4.2.  Cursor and Page Motion
  212.  
  213. NOTE: The arrow keys (see the next four commands) on certain
  214. kinds of terminals will not work with the PDP-11 version  of
  215. vi.   The control versions or the hjkl versions will work on
  216. any  terminal.   Experienced  users  prefer  the  hjkl  keys
  217. because  they  are always right under their fingers.  Begin-
  218. ners often prefer the arrow keys, since they do not  require
  219. memorization of which hjkl key is which.  The mnemonic value
  220. of hjkl is clear from looking at the keyboard of an adm3a.
  221.  
  222.  
  223. [cnt]<bs> or [cnt]h or [cnt]<-
  224.                 Move the cursor to the left  one  character.
  225.                 Cursor stops at the left margin of the page.
  226.                 If cnt is given, these  commands  move  that
  227.                 many spaces.
  228.  
  229. [cnt]^N or [cnt]j or [cnt]v or [cnt]<lf>
  230.                 Move  down  one line.  Moving off the screen
  231.                 scrolls the window to force a new line  onto
  232.                 the screen.  Mnemonic: Next
  233.  
  234. [cnt]^P or [cnt]k or [cnt]^
  235.                 Move up one line.  Moving off the top of the
  236.                 screen forces  new  text  onto  the  screen.
  237.                 Mnemonic: Previous
  238.  
  239. [cnt]<sp> or [cnt]l or [cnt]->
  240.                 Move  to  the  right  one character.  Cursor
  241.                 will not go beyond the end of the line.
  242.  
  243. [cnt]-          Move the cursor up the screen to the  begin-
  244.                 ning of the next line.  Scroll if necessary.
  245.  
  246. [cnt]+ or [cnt]<cr>
  247.  
  248.                 Move the  cursor  down  the  screen  to  the
  249.                 beginning  of  the  next line.  Scroll up if
  250.                 necessary.
  251.  
  252. [cnt]$          Move the cursor to the end of the line.   If
  253.                 there  is  a  count,  move to the end of the
  254.                 line "cnt" lines forward in the file.
  255.  
  256. ^               Move the cursor  to  the  beginning  of  the
  257.                 first word on the line.
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.                              -5-
  269.  
  270.  
  271. 0               Move  the  cursor  to the left margin of the
  272.                 current line.
  273.  
  274. [cnt]|          Move the cursor to the column  specified  by
  275.                 the count.  The default is column zero.
  276.  
  277. [cnt]w          Move the cursor to the beginning of the next
  278.                 word. If there is a count, then move forward
  279.                 that  many  words and position the cursor at
  280.                 the beginning of the word.  Mnemonic:  next-
  281.                 word
  282.  
  283. [cnt]W          Move the cursor to the beginning of the next
  284.                 word   which   follows   a   "white   space"
  285.                 (<sp>,<tab>, or <nl>).  Ignore other punctu-
  286.                 ation.
  287.  
  288. [cnt]b          Move  the  cursor  to  the  preceding  word.
  289.                 Mnemonic: backup-word
  290.  
  291. [cnt]B          Move  the  cursor to the preceding word that
  292.                 is separated from  the  current  word  by  a
  293.                 "white space" (<sp>,<tab>, or <nl>).
  294.  
  295. [cnt]e          Move  the  cursor  to the end of the current
  296.                 word or the end of the "cnt"'th word  hence.
  297.                 Mnemonic: end-of-word
  298.  
  299. [cnt]E          Move  the  cursor  to the end of the current
  300.                 word which is  delimited  by  "white  space"
  301.                 (<sp>,<tab>, or <nl>).
  302.  
  303. [line number]G
  304.                 Move  the  cursor to the line specified.  Of
  305.                 particular use are the  sequences  "1G"  and
  306.                 "G",  which move the cursor to the beginning
  307.                 and  the  end  of  the  file   respectively.
  308.                 Mnemonic: Go-to
  309.  
  310. NOTE:  The  next four commands (^D, ^U, ^F, ^B) are not true
  311. motion commands, in that they cannot be used as  the  object
  312. of commands such as delete or change.
  313.  
  314. [cnt]^D         Move  the  cursor  down in the file by "cnt"
  315.                 lines (or the last  "cnt"  if  a  new  count
  316.                 isn't  given.  The initial default is half a
  317.                 page.)    The   screen   is   simultaneously
  318.                 scrolled up.  Mnemonic: Down
  319.  
  320. [cnt]^U         Move  the  cursor  up  in  the file by "cnt"
  321.                 lines.    The   screen   is   simultaneously
  322.                 scrolled down.  Mnemonic: Up
  323.  
  324.  
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.                              -6-
  335.  
  336.  
  337. [cnt]^F         Move  the  cursor to the next page.  A count
  338.                 moves that many pages.   Two  lines  of  the
  339.                 previous  page  are  kept  on the screen for
  340.                 continuity if possible.  Mnemonic:  Forward-
  341.                 a-page
  342.  
  343. [cnt]^B         Move  the  cursor to the previous page.  Two
  344.                 lines of the current page are kept if possi-
  345.                 ble.  Mnemonic: Backup-a-page
  346.  
  347. [cnt](          Move the cursor to the beginning of the next
  348.                 sentence.  A sentence is defined  as  ending
  349.                 with  a  ".",  "!",  or "?"  followed by two
  350.                 spaces or a <nl>.
  351.  
  352. [cnt])          Move the cursor backwards to  the  beginning
  353.                 of a sentence.
  354.  
  355. [cnt]}          Move the cursor to the beginning of the next
  356.                 paragraph.  This command works  best  inside
  357.                 nroff documents.  It understands two sets of
  358.                 nroff macros, -ms and  -mm,  for  which  the
  359.                 commands ".IP", ".LP", ".PP", ".QP", "P", as
  360.                 well as the nroff command ".bp" are  consid-
  361.                 ered  to  be  paragraph delimiters.  A blank
  362.                 line also delimits a paragraph.   The  nroff
  363.                 macros  that  it accepts as paragraph delim-
  364.                 iters is adjustable.  See  paragraphs  under
  365.                 the Set Commands section.
  366.  
  367. [cnt]{          Move  the  cursor backwards to the beginning
  368.                 of a paragraph.
  369.  
  370. ]]              Move the cursor to the next "section", where
  371.                 a  section  is  defined by two sets of nroff
  372.                 macros, -ms and -mm, in which ".NH",  ".SH",
  373.                 and  ".H"  delimit a section.  A line begin-
  374.                 ning with a <ff><nl>  sequence,  or  a  line
  375.                 beginning  with a "{" are also considered to
  376.                 be  section  delimiters.   The  last  option
  377.                 makes  it  useful for finding the beginnings
  378.                 of C functions.  The nroff macros  that  are
  379.                 used for section delimiters can be adjusted.
  380.                 See sections under the Set Commands section.
  381.  
  382. [[              Move  the  cursor backwards to the beginning
  383.                 of a section.
  384.  
  385. %               Move the cursor to the matching  parenthesis
  386.                 or  brace.  This is very useful in C or lisp
  387.                 code.  If the cursor is sitting on a (  )  {
  388.                 or  }  the  cursor  is moved to the matching
  389.                 character at the other end of  the  section.
  390.                 If the cursor is not sitting on a brace or a
  391.  
  392.  
  393.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400.                              -7-
  401.  
  402.  
  403.                 parenthesis, vi searches  forward  until  it
  404.                 finds  one and then jumps to the match mate.
  405.  
  406. [cnt]H          If there is no count move the cursor to  the
  407.                 top  left  position on the screen.  If there
  408.                 is a count, then  move  the  cursor  to  the
  409.                 beginning  of  the line "cnt" lines from the
  410.                 top of the screen.  Mnemonic:  Home
  411.  
  412. [cnt]L          If there is no count move the cursor to  the
  413.                 beginning  of  the  last line on the screen.
  414.                 If there is a count, then move the cursor to
  415.                 the  beginning  of the line "cnt" lines from
  416.                 the bottom of the screen.  Mnemonic: Last
  417.  
  418. M               Move the cursor to the beginning of the mid-
  419.                 dle line on the screen.  Mnemonic: Middle
  420.  
  421. m<a-z>          This  command  does not move the cursor, but
  422.                 it marks the place in the file and the char-
  423.                 acter  "<a-z>"  becomes the label for refer-
  424.                 ring to this location in the file.  See  the
  425.                 next two commands.  Mnemonic: mark NOTE: The
  426.                 mark command is not a motion, and cannot  be
  427.                 used  as  the  target  of  commands  such as
  428.                 delete.
  429.  
  430. '<a-z>          Move the cursor to the beginning of the line
  431.                 that is marked with the label "<a-z>".
  432.  
  433. `<a-z>          Move the cursor to the exact position on the
  434.                 line that was marked  with  with  the  label
  435.                 "<a-z>".
  436.  
  437. ''              Move the cursor back to the beginning of the
  438.                 line where it  was  before  the  last  "non-
  439.                 relative"  move.   A  "non-relative" move is
  440.                 something such as a search or a  jump  to  a
  441.                 specific  line in the file, rather than mov-
  442.                 ing the cursor or scrolling the screen.
  443.  
  444. ``              Move the cursor back to the  exact  spot  on
  445.                 the  line  where  it  was located before the
  446.                 last "non-relative" move.
  447.  
  448. 4.3.  Searches
  449.  
  450. The following commands allow you to search for  items  in  a
  451. file.
  452.  
  453. [cnt]f{chr}
  454.  
  455.                 Search  forward  on the line for the next or
  456.                 "cnt"'th occurrence of the character  "chr".
  457.  
  458.  
  459.  
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466.                              -8-
  467.  
  468.  
  469.                 The  cursor  is  placed  at the character of
  470.                 interest.  Mnemonic: find character
  471.  
  472. [cnt]F{chr}
  473.  
  474.                 Search backwards on the line for the next or
  475.                 "cnt"'th  occurrence of the character "chr".
  476.                 The cursor is placed  at  the  character  of
  477.                 interest.
  478.  
  479. [cnt]t{chr}
  480.  
  481.                 Search  forward  on the line for the next or
  482.                 "cnt"'th occurrence of the character  "chr".
  483.                 The  cursor  is  placed  just  preceding the
  484.                 character of interest.  Mnemonic: move  cur-
  485.                 sor up to character
  486.  
  487. [cnt]T{chr}
  488.  
  489.                 Search backwards on the line for the next or
  490.                 "cnt"'th occurrence of the character  "chr".
  491.                 The  cursor  is  placed  just  preceding the
  492.                 character of interest.
  493.  
  494. [cnt];          Repeat the last "f", "F", "t"  or  "T"  com-
  495.                 mand.
  496.  
  497. [cnt],          Repeat  the  last  "f", "F", "t" or "T" com-
  498.                 mand, but in the opposite search  direction.
  499.                 This is useful if you overshoot.
  500.  
  501. [cnt]/[string]/<nl>
  502.                 Search  forward  for  the next occurrence of
  503.                 "string".  Wrap around at  the  end  of  the
  504.                 file  does  occur.   The  final  </>  is not
  505.                 required.
  506.  
  507. [cnt]?[string]?<nl>
  508.                 Search backwards for the next occurrence  of
  509.                 "string".   If  a  count  is  specified, the
  510.                 count becomes the  new  window  size.   Wrap
  511.                 around  at  the  beginning  of the file does
  512.                 occur.  The final <?> is not required.
  513.  
  514. n               Repeat the  last  /[string]/  or  ?[string]?
  515.                 search.  Mnemonic: next occurrence.
  516.  
  517. N               Repeat  the  last  /[string]/  or ?[string]?
  518.                 search, but in the reverse direction.
  519.  
  520. :g/[string]/[editor command]<nl>
  521.  
  522.                 Using the : syntax  it  is  possible  to  do
  523.  
  524.  
  525.  
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532.                              -9-
  533.  
  534.  
  535.                 global  searches  ala the standard UNIX "ed"
  536.                 editor.
  537.  
  538. 4.4.  Text Insertion
  539.  
  540. The following commands allow for the insertion of text.  All
  541. multicharacter  text insertions are terminated with an <esc>
  542. character.  The last change can always be undone by typing a
  543. u.   The text insert in insertion mode can contain newlines.
  544.  
  545. a{text}<esc>    Insert text immediately following the cursor
  546.                 position.  Mnemonic: append
  547.  
  548. A{text}<esc>    Insert  text at the end of the current line.
  549.                 Mnemonic: Append
  550.  
  551. i{text}<esc>    Insert text immediately preceding the cursor
  552.                 position.  Mnemonic: insert
  553.  
  554. I{text}<esc>    Insert  text at the beginning of the current
  555.                 line.
  556.  
  557. o{text}<esc>    Insert a new line after the  line  on  which
  558.                 the  cursor  appears  and insert text there.
  559.                 Mnemonic:  open new line
  560.  
  561. O{text}<esc>    Insert a new  line  preceding  the  line  on
  562.                 which  the  cursor  appears  and insert text
  563.                 there.
  564.  
  565. 4.5.  Text Deletion
  566.  
  567. The following commands allow the user to delete text in var-
  568. ious ways.  All changes can always be undone by typing the u
  569. command.
  570.  
  571. [cnt]x          Delete the character or characters  starting
  572.                 at the cursor position.
  573.  
  574. [cnt]X          Delete  the character or characters starting
  575.                 at the character preceding the cursor  posi-
  576.                 tion.
  577.  
  578. D               Deletes  the  remainder of the line starting
  579.                 at the cursor.  Mnemonic: Delete the rest of
  580.                 line
  581.  
  582. [cnt]d{motion}
  583.                 Deletes one or more occurrences of the spec-
  584.                 ified motion.  Any motion from sections  4.1
  585.                 and  4.2  can  be  used  here.  The d can be
  586.                 stuttered  (e.g.  [cnt]dd)  to  delete   cnt
  587.                 lines.
  588.  
  589.  
  590.  
  591.  
  592.  
  593.  
  594.  
  595.  
  596.  
  597.  
  598.                             -10-
  599.  
  600.  
  601. 4.6.  Text Replacement
  602.  
  603. The  following  commands  allow  the  user to simultaneously
  604. delete and insert new text.  All such actions can be  undone
  605. by typing u following the command.
  606.  
  607. r<chr>          Replaces the character at the current cursor
  608.                 position with <chr>.  This is a one  charac-
  609.                 ter  replacement.   No <esc> is required for
  610.                 termination.  Mnemonic:  replace character
  611.  
  612. R{text}<esc>    Starts  overlaying  the  characters  on  the
  613.                 screen  with whatever you type.  It does not
  614.                 stop until an <esc> is typed.
  615.  
  616. [cnt]s{text}<esc>
  617.                 Substitute for "cnt" characters beginning at
  618.                 the  current  cursor  position.   A "$" will
  619.                 appear at the position in the text where the
  620.                 "cnt"'th  character appears so you will know
  621.                 how much you are erasing.  Mnemonic: substi-
  622.                 tute
  623.  
  624. [cnt]S{text}<esc>
  625.                 Substitute  for  the entire current line (or
  626.                 lines).  If no count is given, a "$" appears
  627.                 at  the end of the current line.  If a count
  628.                 of more than 1 is given, all the lines to be
  629.                 replaced  are  deleted  before the insertion
  630.                 begins.
  631.  
  632. [cnt]c{motion}{text}<esc>
  633.                 Change the specified "motion"  by  replacing
  634.                 it  with  the  insertion  text.   A "$" will
  635.                 appear at the end of the last item  that  is
  636.                 being  deleted  unless the deletion involves
  637.                 whole lines.  Motion's  can  be  any  motion
  638.                 from  sections 4.1 or 4.2.  Stuttering the c
  639.                 (e.g. [cnt]cc) changes cnt lines.
  640.  
  641. 4.7.  Moving Text
  642.  
  643. Vi provides a number  of  ways  of  moving  chunks  of  text
  644. around.   There  are  nine  buffers into which each piece of
  645. text which is deleted or "yanked" is put in addition to  the
  646. "undo"  buffer.   The most recent deletion or yank is in the
  647. "undo" buffer and also usually in buffer 1,  the  next  most
  648. recent  in buffer 2, and so forth.  Each new deletion pushes
  649. down all the older deletions.  Deletions older than 9 disap-
  650. pear.   There  is  also  a set of named registers, a-z, into
  651. which text can optionally  be  placed.   If  any  delete  or
  652. replacement  type  command is preceded by "<a-z>, that named
  653. buffer will contain the text deleted after  the  command  is
  654. executed.   For  example,  "a3dd  will  delete  three  lines
  655.  
  656.  
  657.  
  658.  
  659.  
  660.  
  661.  
  662.  
  663.  
  664.                             -11-
  665.  
  666.  
  667. starting at the current line and put  them  in  buffer  "a.*
  668. There are two more basic commands and some variations useful
  669. in getting and putting text into a file.
  670.  
  671. ["<a-z>][cnt]y{motion}
  672.  
  673.                 Yank the specified item or "cnt"  items  and
  674.                 put  in  the  "undo" buffer or the specified
  675.                 buffer.  The variety of "items" that can  be
  676.                 yanked  is  the  same  as  those that can be
  677.                 deleted with the "d" command or changed with
  678.                 the  "c" command.  In the same way that "dd"
  679.                 means delete the current line and "cc" means
  680.                 replace  the  current  line, "yy" means yank
  681.                 the current line.
  682.  
  683. ["<a-z>][cnt]Y  Yank the current line  or  the  "cnt"  lines
  684.                 starting  from  the  current  line.   If  no
  685.                 buffer is specified, they will go  into  the
  686.                 "undo" buffer, like any delete would.  It is
  687.                 equivalent to "yy".  Mnemonic:  Yank
  688.  
  689. ["<a-z>]p       Put "undo" buffer or  the  specified  buffer
  690.                 down  after the cursor.  If whole lines were
  691.                 yanked or deleted into the buffer, then they
  692.                 will  be  put down on the line following the
  693.                 line the cursor is on.   If  something  else
  694.                 was  deleted,  like a word or sentence, then
  695.                 it will be  inserted  immediately  following
  696.                 the cursor.  Mnemonic:  put buffer
  697.  
  698.                 It  should  be  noted that text in the named
  699.                 buffers remains there when you start editing
  700.                 a  new  file  with the :e file<esc> command.
  701.                 Since this is so, it is possible to copy  or
  702.                 delete  text from one file and carry it over
  703.                 to another file in  the  buffers.   However,
  704.                 the  undo buffer and the ability to undo are
  705.                 lost when changing files.
  706.  
  707. ["<a-z>]P       Put "undo" buffer or  the  specified  buffer
  708.                 down  before  the  cursor.   If  whole lines
  709.                 where yanked or  deleted  into  the  buffer,
  710.                 then  they will be put down on the line pre-
  711.                 ceding the line the cursor is on.  If  some-
  712.                 thing  else was deleted, like a word or sen-
  713.                 tence, then it will be inserted  immediately
  714.                 preceding the cursor.
  715.  
  716. -----------
  717. * Referring to an upper case letter  as  a  buffer
  718. name  (A-Z)  is the same as referring to the lower
  719. case letter, except that text  placed  in  such  a
  720. buffer  is appended to it instead of replacing it.
  721.  
  722.  
  723.  
  724.  
  725.  
  726.  
  727.  
  728.  
  729.  
  730.                             -12-
  731.  
  732.  
  733. [cnt]>{motion}  The  shift operator will right shift all the
  734.                 text from the line on which  the  cursor  is
  735.                 located  to  the  line  where  the motion is
  736.                 located.   The  text  is  shifted   by   one
  737.                 shiftwidth.   (See  section  6.)   >>  means
  738.                 right shift the current line or lines.
  739.  
  740. [cnt]<{motion}  The shift operator will left shift  all  the
  741.                 text  from  the  line on which the cursor is
  742.                 located  to  the  line  where  the  item  is
  743.                 located.    The   text  is  shifted  by  one
  744.                 shiftwidth.  (See section 6.)  << means left
  745.                 shift  the  current line or lines.  Once the
  746.                 line has reached the left margin it  is  not
  747.                 further affected.
  748.  
  749. [cnt]={motion}  Prettyprints the indicated area according to
  750.                 lisp conventions.  The area should be a lisp
  751.                 s-expression.
  752.  
  753. 4.8.  Miscellaneous Commands
  754.  
  755. Vi has a number of miscellaneous commands that are very use-
  756. ful.  They are:
  757.  
  758. ZZ              This is the normal way to exit from vi.   If
  759.                 any  changes  have  been  made,  the file is
  760.                 written out.  Then you are returned  to  the
  761.                 shell.
  762.  
  763. ^L              Redraw  the  current screen.  This is useful
  764.                 if someone "write"s you  while  you  are  in
  765.                 "vi"  or if for any reason garbage gets onto
  766.                 the screen.
  767.  
  768. ^R              On dumb  terminals,  those  not  having  the
  769.                 "delete  line" function (the vt100 is such a
  770.                 terminal), vi  saves  redrawing  the  screen
  771.                 when  you  delete a line by just marking the
  772.                 line with an "@" at the beginning and blank-
  773.                 ing  the  line.  If you want to actually get
  774.                 rid of the lines marked  with  "@"  and  see
  775.                 what  the  page looks like, typing a ^R will
  776.                 do this.
  777.  
  778. .               "Dot" is a particularly useful command.   It
  779.                 repeats  the  last  text  modifying command.
  780.                 Therefore you can type a  command  once  and
  781.                 then  to another place and repeat it by just
  782.                 typing ".".
  783.  
  784. u               Perhaps the most important  command  in  the
  785.                 editor,  u  undoes  the  last  command  that
  786.                 changed the buffer.  Mnemonic:  undo
  787.  
  788.  
  789.  
  790.  
  791.  
  792.  
  793.  
  794.  
  795.  
  796.                             -13-
  797.  
  798.  
  799. U               Undo all the text  modifying  commands  per-
  800.                 formed  on  the  current line since the last
  801.                 time you moved onto it.
  802.  
  803. [cnt]J          Join the  current  line  and  the  following
  804.                 line.  The <nl> is deleted and the two lines
  805.                 joined, usually with a space between the end
  806.                 of  the first line and the beginning of what
  807.                 was the second  line.   If  the  first  line
  808.                 ended  with  a "period", then two spaces are
  809.                 inserted.  A count joins the next cnt lines.
  810.                 Mnemonic: Join lines
  811.  
  812. Q               Switch  to ex editing mode.  In this mode vi
  813.                 will behave very much like ed.   The  editor
  814.                 in  this  mode  will operate on single lines
  815.                 normally and will not attempt  to  keep  the
  816.                 "window"  up  to date.  Once in this mode it
  817.                 is also possible to switch to the open  mode
  818.                 of  editing.   By entering the command [line
  819.                 number]open<nl> you enter this mode.  It  is
  820.                 similar to the normal visual mode except the
  821.                 window is only  one  line  long.   Mnemonic:
  822.                 Quit visual mode
  823.  
  824. ^]              An abbreviation for a tag command.  The cur-
  825.                 sor should be positioned at the beginning of
  826.                 a  word.   That word is taken as a tag name,
  827.                 and the tag with that name is found as if it
  828.                 had been typed in a :tag command.
  829.  
  830. [cnt]!{motion}{UNIX cmd}<nl>
  831.                 Any UNIX filter (e.g. command that reads the
  832.                 standard input and outputs something to  the
  833.                 standard  output)  can  be sent a section of
  834.                 the current file and have the output of  the
  835.                 command  replace  the original text.  Useful
  836.                 examples are programs  like  cb,  sort,  and
  837.                 nroff.  For instance, using sort it would be
  838.                 possible to sort a section  of  the  current
  839.                 file into a new list.  Using !! means take a
  840.                 line or lines starting at the line the  cur-
  841.                 sor  is  currently  on  and pass them to the
  842.                 UNIX command.  NOTE: To just escape  to  the
  843.                 shell  for one command, use :!{cmd}<nl>, see
  844.                 section 5.
  845.  
  846. z{cnt}<nl>      This resets the current window size to "cnt"
  847.                 lines and redraws the screen.
  848.  
  849. 4.9.  Special Insert Characters
  850.  
  851. There  are some characters that have special meanings during
  852. insert modes.  They are:
  853.  
  854.  
  855.  
  856.  
  857.  
  858.  
  859.  
  860.  
  861.  
  862.                             -14-
  863.  
  864.  
  865. ^V              During inserts, typing a ^V  allows  you  to
  866.                 quote control characters into the file.  Any
  867.                 character  typed  after  the  ^V   will   be
  868.                 inserted into the file.
  869.  
  870. [^]^D or [0]^D  <^D>  without  any  argument  backs  up  one
  871.                 shiftwidth.  This  is  necessary  to  remove
  872.                 indentation that was inserted by the autoin-
  873.                 dent feature.  ^<^D> temporarily removes all
  874.                 the autoindentation, thus placing the cursor
  875.                 at the left margin.  On the next  line,  the
  876.                 previous  indent  level  will  be  restored.
  877.                 This is useful for putting "labels"  at  the
  878.                 left  margin.  0<^D> says remove all autoin-
  879.                 dents and stay that way.   Thus  the  cursor
  880.                 moves  to the left margin and stays there on
  881.                 successive lines until  <tab>'s  are  typed.
  882.                 As  with  the <tab>, the <^D> is only effec-
  883.                 tive before any other "non-autoindent"  con-
  884.                 trolling  characters  are  typed.  Mnemonic:
  885.                 Delete a shiftwidth
  886.  
  887. ^W              If the cursor is sitting  on  a  word,  <^W>
  888.                 moves  the  cursor  back to the beginning of
  889.                 the word, thus erasing  the  word  from  the
  890.                 insert.  Mnemonic: erase Word
  891.  
  892. <bs>            The backspace always serves as an erase dur-
  893.                 ing insert modes in addition to your  normal
  894.                 "erase"  character.   To  insert a <bs> into
  895.                 your file, use the <^V> to quote it.
  896.  
  897. 5.  : Commands
  898.  
  899. Typing a ":" during command mode causes vi to put the cursor
  900. at  the  bottom  on the screen in preparation for a command.
  901. In the ":" mode, vi can be given most ed  commands.   It  is
  902. also  from this mode that you exit from vi or switch to dif-
  903. ferent files.  All commands of this variety  are  terminated
  904. by a <nl>, <cr>, or <esc>.
  905.  
  906. :w[!] [file]    Causes  vi  to write out the current text to
  907.                 the disk.  It is written to the file you are
  908.                 editing   unless  "file"  is  supplied.   If
  909.                 "file" is supplied, the write is directed to
  910.                 that  file  instead.   If  that file already
  911.                 exists, vi will not perform the write unless
  912.                 the  "!"  is  supplied indicating you really
  913.                 want to destroy the older copy of the  file.
  914.  
  915. :q[!]           Causes vi to exit.  If you have modified the
  916.                 file  you  are  looking  at  currently   and
  917.                 haven't  written  it  out, vi will refuse to
  918.                 exit unless the "!" is supplied.
  919.  
  920.  
  921.  
  922.  
  923.  
  924.  
  925.  
  926.  
  927.  
  928.                             -15-
  929.  
  930.  
  931. :e[!] [+[cmd]] [file]
  932.  
  933.                 Start editing a new file  called  "file"  or
  934.                 start  editing  the current file over again.
  935.                 The command ":e!" says "ignore  the  changes
  936.                 I've  made  to this file and start over from
  937.                 the beginning".  It is useful if you  really
  938.                 mess  up  the  file.   The optional "+" says
  939.                 instead of starting at the beginning,  start
  940.                 at the "end", or, if "cmd" is supplied, exe-
  941.                 cute "cmd" first.  Useful cases of this  are
  942.                 where  cmd is "n" (any integer) which starts
  943.                 at  line  number  n,  and   "/text",   which
  944.                 searches  for  "text" and starts at the line
  945.                 where it is found.
  946.  
  947. ^^              Switch back to the  place  you  were  before
  948.                 your  last  tag  command.   If your last tag
  949.                 command stayed within the file,  ^^  returns
  950.                 to that tag.  If you have no recent tag com-
  951.                 mand, it will return to the  same  place  in
  952.                 the  previous  file that it was showing when
  953.                 you switched to the current file.
  954.  
  955. :n[!]           Start editing the next file in the  argument
  956.                 list.   Since vi can be called with multiple
  957.                 file names, the ":n"  command  tells  it  to
  958.                 stop  work on the current file and switch to
  959.                 the next file.  If the current file was mod-
  960.                 ifies,  it  has to be written out before the
  961.                 ":n" will work or else the "!" must be  sup-
  962.                 plied, which says discard the changes I made
  963.                 to the current file.
  964.  
  965. :n[!] file [file file ...]
  966.  
  967.                 Replace the current argument list with a new
  968.                 list  of  files  and start editing the first
  969.                 file in this new list.
  970.  
  971. :r file         Read in a copy of "file" on the  line  after
  972.                 the cursor.
  973.  
  974. :r !cmd         Execute  the  "cmd"  and take its output and
  975.                 put it into the file after the current line.
  976.  
  977. :!cmd           Execute any UNIX shell command.
  978.  
  979. :ta[!] tag      Vi  looks in the file named tags in the cur-
  980.                 rent directory.  Tags is a file of lines  in
  981.                 the format:
  982.  
  983.                         tag filename vi-search-command
  984.  
  985.  
  986.  
  987.  
  988.  
  989.  
  990.  
  991.  
  992.  
  993.  
  994.                             -16-
  995.  
  996.  
  997.                 If vi finds the tag you specified in the :ta
  998.                 command, it stops editing the  current  file
  999.                 if  necessary  and if the current file is up
  1000.                 to date on the disk and switches to the file
  1001.                 specified and uses the search pattern speci-
  1002.                 fied to find the "tagged" item of  interest.
  1003.                 This  is  particularly  useful  when editing
  1004.                 multi-file C programs such as the  operating
  1005.                 system.   There  is  a  program called ctags
  1006.                 which will generate an appropriate tags file
  1007.                 for C and f77 programs so that by saying :ta
  1008.                 function<nl> you will be  switched  to  that
  1009.                 function.   It  could  also  be  useful when
  1010.                 editing  multi-file  documents,  though  the
  1011.                 tags  file  would have to be generated manu-
  1012.                 ally.
  1013.  
  1014. 6.  Special Arrangements for Startup
  1015.  
  1016.      Vi takes the value of $TERM and looks up the character-
  1017. istics  of  that  terminal in the file /etc/termcap.  If you
  1018. don't know vi's name for the terminal you  are  working  on,
  1019. look in /etc/termcap.
  1020.  
  1021.      When vi starts, it attempts to read the variable EXINIT
  1022. from your environment.*  If that exists, it takes the values
  1023. in it as the default values for certain of its internal con-
  1024. stants.   See  the  section  on  "Set  Values"  for  further
  1025. details.   If EXINIT doesn't exist you will get all the nor-
  1026. mal defaults.
  1027.  
  1028.      Should you inadvertently hang up the phone while inside
  1029. vi, or should the computer crash, all may not be lost.  Upon
  1030. returning to the system, type:
  1031.  
  1032.      vi -r file
  1033.  
  1034. This will normally recover the file.  If there is more  than
  1035. one temporary file for a specific file name, vi recovers the
  1036. newest one.  You can get an older version by recovering  the
  1037. file  more  than  once.   The command "vi -r" without a file
  1038. name gives you the list of files that were saved in the last
  1039. system crash (but not the file just saved when the phone was
  1040. hung up).
  1041.  
  1042. 7.  Set Commands
  1043.  
  1044. Vi has a number of internal variables and switches which can
  1045. be  set  to  achieve special affects.  These options come in
  1046. three forms, those that are switches, which toggle from  off
  1047. -----------
  1048. * On version 6 systems Instead of EXINIT, put  the
  1049. startup  commands  in  the file .exrc in your home
  1050. directory.
  1051.  
  1052.  
  1053.  
  1054.  
  1055.  
  1056.  
  1057.  
  1058.  
  1059.  
  1060.                             -17-
  1061.  
  1062.  
  1063. to  on  and  back,  those  that require a numeric value, and
  1064. those that require an alphanumeric string value.  The toggle
  1065. options are set by a command of the form:
  1066.  
  1067.      :set option<nl>
  1068.  
  1069. and turned off with the command:
  1070.  
  1071.      :set nooption<nl>
  1072.  
  1073. Commands  requiring  a  value  are set with a command of the
  1074. form:
  1075.  
  1076.      :set option=value<nl>
  1077.  
  1078. To display the value of a specific option type:
  1079.  
  1080.      :set option?<nl>
  1081.  
  1082. To display only those that you have changed type:
  1083.  
  1084.      :set<nl>
  1085.  
  1086. and to display the long table of all the settable parameters
  1087. and their current values type:
  1088.  
  1089.      :set all<nl>
  1090.  
  1091.  
  1092.      Most  of  the options have a long form and an abbrevia-
  1093. tion.  Both are listed in the following table as well as the
  1094. normal default value.
  1095.  
  1096.      To  arrange  to have values other than the default used
  1097. every time you enter vi, place the appropriate  set  command
  1098. in EXINIT in your environment, e.g.
  1099.  
  1100.      EXINIT='set ai aw terse sh=/bin/csh'
  1101.      export EXINIT
  1102.  
  1103. or
  1104.  
  1105.      setenv EXINIT 'set ai aw terse sh=/bin/csh'
  1106.  
  1107. for  sh  and csh, respectively.  These are usually placed in
  1108. your .profile or .login.  If you are running a system  with-
  1109. out  environments  (such as version 6) you can place the set
  1110. command in the file .exrc in your home directory.
  1111.  
  1112. autoindent ai   Default: noai Type: toggle
  1113.                 When in autoindent mode, vi helps you indent
  1114.                 code  by starting each line in the same col-
  1115.                 umn as the preceding line.  Tabbing  to  the
  1116.                 right  with  <tab>  or  <^T>  will move this
  1117.  
  1118.  
  1119.  
  1120.  
  1121.  
  1122.  
  1123.  
  1124.  
  1125.  
  1126.                             -18-
  1127.  
  1128.  
  1129.                 boundary to the right, and it can  be  moved
  1130.                 to the left with <^D>.
  1131.  
  1132. autoprint ap    Default: ap Type: toggle
  1133.                 Causes  the current line to be printed after
  1134.                 each ex text modifying command.  This is not
  1135.                 of  much  interest  in  the normal vi visual
  1136.                 mode.
  1137.  
  1138. autowrite aw    Default: noaw type: toggle
  1139.                 Autowrite causes an automatic  write  to  be
  1140.                 done  if  there  are  unsaved changes before
  1141.                 certain commands which change files or  oth-
  1142.                 erwise  interact  with  the  outside  world.
  1143.                 These commands are :!, :tag, :next, :rewind,
  1144.                 ^^, and ^].
  1145.  
  1146. beautify bf     Default: nobf Type: toggle
  1147.                 Causes  all control characters except <tab>,
  1148.                 <nl>, and <ff> to be discarded.
  1149.  
  1150. directory dir   Default: dir=/tmp Type: string
  1151.                 This is the directory in which vi  puts  its
  1152.                 temporary file.
  1153.  
  1154. errorbells eb   Default: noeb Type: toggle
  1155.                 Error messages are preceded by a <bell>.
  1156.  
  1157. hardtabs ht     Default: hardtabs=8 Type: numeric
  1158.                 This  option  contains the value of hardware
  1159.                 tabs in your terminal, or of  software  tabs
  1160.                 expanded by the Unix system.
  1161.  
  1162. ignorecase ic   Default: noic Type: toggle
  1163.                 All  upper  case  characters  are  mapped to
  1164.                 lower case in regular expression matching.
  1165.  
  1166. lisp            Default: nolisp Type: toggle
  1167.                 Autoindent for lisp code.  The commands (  )
  1168.                 [[  and  ]]  are  modified  appropriately to
  1169.                 affect s-expressions and functions.
  1170.  
  1171. list            Default: nolist Type: toggle
  1172.                 All printed lines have the  <tab>  and  <nl>
  1173.                 characters displayed visually.
  1174.  
  1175. magic           Default: magic Type: toggle
  1176.                 Enable   the  metacharacters  for  matching.
  1177.                 These include . * < > [string] [^string] and
  1178.                 [<chr>-<chr>].
  1179.  
  1180. number nu       Default: nonu Type: toggle
  1181.                 Each line is displayed with its line number.
  1182.  
  1183.  
  1184.  
  1185.  
  1186.  
  1187.  
  1188.  
  1189.  
  1190.  
  1191.  
  1192.                             -19-
  1193.  
  1194.  
  1195. open            Default: open Type: toggle
  1196.                 When set, prevents entering open  or  visual
  1197.                 modes from ex or edit.  Not of interest from
  1198.                 vi.
  1199.  
  1200. optimize opt    Default: opt Type: toggle
  1201.                 Basically of use  only  when  using  the  ex
  1202.                 capabilities.   This  option  prevents auto-
  1203.                 matic <cr>s from taking place, and speeds up
  1204.                 output  of indented lines, at the expense of
  1205.                 losing typeahead on some versions of UNIX.
  1206.  
  1207. paragraphs para Default: para=IPLPPPQPP bp Type: string
  1208.                 Each pair of characters in the string  indi-
  1209.                 cate nroff macros which are to be treated as
  1210.                 the beginning of a paragraph for the { and }
  1211.                 commands.  The default string is for the -ms
  1212.                 and -mm  macros.   To  indicate  one  letter
  1213.                 nroff  macros,  such  as  .P  or .H, quote a
  1214.                 space in for the second character  position.
  1215.                 For example:
  1216.  
  1217.                         :set paragraphs=P\ bp<nl>
  1218.  
  1219.                 would  cause  vi  to  consider .P and .bp as
  1220.                 paragraph delimiters.
  1221.  
  1222. prompt          Default: prompt Type: toggle
  1223.                 In ex command mode the  prompt  character  :
  1224.                 will  be  printed  when  ex is waiting for a
  1225.                 command.  This is not of interest from vi.
  1226.  
  1227. redraw          Default: noredraw Type: toggle
  1228.                 On  dumb  terminals,  force  the  screen  to
  1229.                 always  be  up  to  date,  by  sending great
  1230.                 amounts of  output.   Useful  only  at  high
  1231.                 speeds.
  1232.  
  1233. report          Default: report=5 Type: numeric
  1234.                 This  sets  the  threshold for the number of
  1235.                 lines modified.  When more than this  number
  1236.                 of  lines  are modified, removed, or yanked,
  1237.                 vi will report the number of  lines  changed
  1238.                 at the bottom of the screen.
  1239.  
  1240. scroll          Default: scroll={1/2 window} Type: numeric
  1241.                 This  is the number of lines that the screen
  1242.                 scrolls up or down when using the  <^U>  and
  1243.                 <^D> commands.
  1244.  
  1245. sections        Default: sections=SHNHH HU Type: string
  1246.                 Each two character pair of this string spec-
  1247.                 ify  nroff  macro  names  which  are  to  be
  1248.                 treated as the beginning of a section by the
  1249.  
  1250.  
  1251.  
  1252.  
  1253.  
  1254.  
  1255.  
  1256.  
  1257.  
  1258.                             -20-
  1259.  
  1260.  
  1261.                 ]] and [[ commands.  The default  string  is
  1262.                 for  the  -ms  and -mm macros.  To enter one
  1263.                 letter nroff macros, use a quoted  space  as
  1264.                 the  second character.  See paragraphs for a
  1265.                 fuller explanation.
  1266.  
  1267. shell sh        Default:  sh=from   environment   SHELL   or
  1268.                 /bin/sh   Type: string
  1269.                 This  is  the  name of the sh to be used for
  1270.                 "escaped" commands.
  1271.  
  1272. shiftwidth sw   Default: sw=8 Type: numeric
  1273.                 This is the number of spaces that a <^T>  or
  1274.                 <^D>  will  move over for indenting, and the
  1275.                 amount < and > shift by.
  1276.  
  1277. showmatch sm    Default: nosm Type: toggle
  1278.                 When a ) or } is typed, show the matching  (
  1279.                 or { by moving the cursor to it for one sec-
  1280.                 ond if it is on the current screen.
  1281.  
  1282. slowopen slow   Default: terminal dependent Type: toggle
  1283.                 On terminals that are  slow  and  unintelli-
  1284.                 gent,  this  option prevents the updating of
  1285.                 the screen  some  of  the  time  to  improve
  1286.                 speed.
  1287.  
  1288. tabstop ts      Default: ts=8 Type: numeric
  1289.                 <tab>s  are  expanded to boundaries that are
  1290.                 multiples of this value.
  1291.  
  1292. taglength tl    Default: tl=0 Type: numeric
  1293.                 If nonzero, tag names are  only  significant
  1294.                 to this many characters.
  1295.  
  1296. term            Default:  (from environment TERM, else dumb)
  1297.                 Type: string
  1298.                 This is the terminal and controls the visual
  1299.                 displays.   It  cannot  be  changed  when in
  1300.                 "visual" mode, you  have  to  Q  to  command
  1301.                 mode,  type  a  set  term  command,  and  do
  1302.                 ``vi.'' to get back into  visual.   Or  exit
  1303.                 vi, fix $TERM, and reenter.  The definitions
  1304.                 that drive a particular  terminal  type  are
  1305.                 found in the file /etc/termcap.
  1306.  
  1307. terse           Default: terse Type: toggle
  1308.                 When set, the error diagnostics are short.
  1309.  
  1310. warn            Default: warn Type: toggle
  1311.                 The user is warned if she/he tries to escape
  1312.                 to the shell without writing out the current
  1313.                 changes.
  1314.  
  1315.  
  1316.  
  1317.  
  1318.  
  1319.  
  1320.  
  1321.  
  1322.  
  1323.  
  1324.                             -21-
  1325.  
  1326.  
  1327. window          Default:  window={8  at 600 baud or less, 16
  1328.                 at 1200 baud, and screen size -  1  at  2400
  1329.                 baud or more} Type: numeric
  1330.                 This  is  the  number of lines in the window
  1331.                 whenever vi must redraw  an  entire  screen.
  1332.                 It  is  useful  to make this size smaller if
  1333.                 you are on a slow line.
  1334.  
  1335. w300, w1200, w9600
  1336.                 These set window, but only within the corre-
  1337.                 sponding  speed  ranges.  They are useful in
  1338.                 an EXINIT to fine tune  window  sizes.   For
  1339.                 example,
  1340.  
  1341.                      set w300=4 w1200=12
  1342.  
  1343.                 causes  a  4 lines window at speed up to 600
  1344.                 baud, a 12 line window at 1200 baud,  and  a
  1345.                 full screen (the default) at over 1200 baud.
  1346.  
  1347. wrapscan ws     Default: ws Type: toggle
  1348.                 Searches will wrap around  the  end  of  the
  1349.                 file when is option is set.  When it is off,
  1350.                 the search will terminate  when  it  reaches
  1351.                 the end or the beginning of the file.
  1352.  
  1353. wrapmargin wm   Default: wm=0 Type: numeric
  1354.                 Vi  will automatically insert a <nl> when it
  1355.                 finds a natural break point (usually a  <sp>
  1356.                 between   words)  that  occurs  within  "wm"
  1357.                 spaces of the right margin.  Therefore  with
  1358.                 "wm=0"  the option is off.  Setting it to 10
  1359.                 would mean that any time you are  within  10
  1360.                 spaces of the right margin vi would be look-
  1361.                 ing for a  <sp>  or  <tab>  which  it  could
  1362.                 replace with a <nl>.  This is convenient for
  1363.                 people who forget  to  look  at  the  screen
  1364.                 while  they type.  (In version 3, wrapmargin
  1365.                 behaves more like nroff, in that the  bound-
  1366.                 ary specified by the distance from the right
  1367.                 edge of the screen is taken as the rightmost
  1368.                 edge  of  the area where a break is allowed,
  1369.                 instead of the leftmost edge.)
  1370.  
  1371. writeany wa     Default: nowa Type: toggle
  1372.                 Vi normally makes a number of checks  before
  1373.                 it  writes  out  a  file.  This prevents the
  1374.                 user from inadvertently destroying  a  file.
  1375.                 When the "writeany" option is enabled, vi no
  1376.                 longer makes these checks.
  1377.  
  1378.  
  1379.  
  1380.  
  1381.  
  1382.  
  1383.  
  1384.  
  1385.  
  1386.  
  1387.