vi.html 56 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125
  1. <head>
  2. <title>vi Reference</title>
  3. <link rel="help" href="http://www.facebook.com/pages/vi-Reference/122185502017" />
  4. </head>
  5. <body>
  6. <table border=0>
  7. <tr valign=bottom>
  8. <td width=90%>
  9. <h1><tt>vi Reference</tt></h1>
  10. </td>
  11. <td>
  12. <script src="http://static.ak.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php/en_US" type="text/javascript"></script><script type="text/javascript">FB.init("90aa59336a14bf3bb1b0e2a79a685b9b");</script><fb:fan profile_id="122185502017" stream="" connections="" width="300"></fb:fan><div style="font-family:sans-serif; font-size:10px; padding-left:10px"><a href="http://www.facebook.com/pages/vi-Reference/122185502017">vi Reference on Facebook</a> is a blog that provides answers to topics suggested in the search engine hits that lead people to this page.</div>
  13. </td>
  14. </tr>
  15. </table>
  16. <hr>
  17. <pre>
  18. Warning: some vi versions don't support the more esoteric features
  19. described in this document. You can edit/redistribute this document
  20. freely, as long as you don't make false claims on original authorship.
  21. Author: Maarten Litmaath &lt;maart@nat.vu.nl&gt;
  22. Maintainer: James Hu &lt;jxh@despammed.com&gt;
  23. Version: 11
  24. This document is also available in <a href="vi.reference">plaintext</a> and <a href="vi.reference.pdf">PDF</a>.
  25. </pre>
  26. <hr>
  27. <table>
  28. <tr>
  29. <td><a href="#s20">k</a></td>
  30. <th rowspan=2><tt><font size=5><a name="s2">contents</a></font></tt></th>
  31. </tr>
  32. <tr>
  33. <td><a href="#s3">j</a></td>
  34. </tr>
  35. </table>
  36. <pre>
  37. <a href="#s3">contributions</a>
  38. <a href="#s4">legenda</a>
  39. <a href="#s5">move commands</a>
  40. <a href="#s6">searching</a>
  41. <a href="#s7">undoing changes</a>
  42. <a href="#s8">appending text</a>
  43. <a href="#s9">deleting text</a>
  44. <a href="#s10">changing text</a>
  45. <a href="#s11">substitute replacement patterns</a>
  46. <a href="#s12">remembering text</a>
  47. <a href="#s13">commands while in append|change mode</a>
  48. <a href="#s14">writing, editing other files, and quitting vi</a>
  49. <a href="#s15">display commands</a>
  50. <a href="#s16">mapping and abbreviation</a>
  51. <a href="#s17">switch and shell commands</a>
  52. <a href="#s18">vi startup</a>
  53. <a href="#s19">changing and viewing options</a>
  54. <a href="#s20">the most important options</a>
  55. </pre>
  56. <hr>
  57. <table>
  58. <tr>
  59. <td><a href="#s2">k</a></td>
  60. <th rowspan=2><tt><font size=5><a name="s3">contributions</a></font></tt></th>
  61. </tr>
  62. <tr>
  63. <td><a href="#s4">j</a></td>
  64. </tr>
  65. </table>
  66. <pre>
  67. Rich Salz &lt;rsalz@bbn.com&gt;
  68. Eamonn McManus &lt;emcmanus@cs.tcd.ie&gt;
  69. Diomidis Spinellis &lt;diomidis%ecrcvax.uucp@pyramid.pyramid.com&gt;
  70. Blair P. Houghton &lt;bph@buengc.bu.edu&gt;
  71. Rusty Haddock &lt;{uunet,att,rutgers}!mimsy.umd.edu!fe2o3!rusty&gt;
  72. Panos Tsirigotis &lt;panos@boulder.colorado.edu&gt;
  73. David J. MacKenzie &lt;djm@wam.umd.edu&gt;
  74. Kevin Carothers &lt;kevin@ttidca.tti.com&gt;
  75. Dan Mercer &lt;mercer@ncrcce.StPaul.NCR.COM&gt;
  76. Ze'ev Shtadler &lt;steed@il4cad.intel.com&gt;
  77. Paul Quare &lt;pq@r2.cs.man.ac.uk&gt;
  78. Dave Beyerl &lt;att!ihlpl!db21&gt;
  79. Lee Sailer &lt;UH2@psuvm.psu.edu&gt;
  80. David Gast &lt;gast@cs.ucla.edu&gt;
  81. John Arundel &lt;john@splange.freeserve.co.uk&gt;
  82. James Hu &lt;jxh@cs.wustl.edu&gt;
  83. </pre>
  84. <hr>
  85. <table>
  86. <tr>
  87. <td><a href="#s3">k</a></td>
  88. <th rowspan=2><tt><font size=5><a name="s4">legenda</a></font></tt></th>
  89. </tr>
  90. <tr>
  91. <td><a href="#s5">j</a></td>
  92. </tr>
  93. </table>
  94. <pre>
  95. default values : 1
  96. &lt;*&gt; : `*' must not be taken literally
  97. [*] : `*' is optional
  98. ^X : &lt;ctrl&gt;X
  99. &lt;sp&gt; : space
  100. &lt;cr&gt; : carriage return
  101. &lt;lf&gt; : linefeed
  102. &lt;ht&gt; : horizontal tab
  103. &lt;esc&gt; : escape
  104. &lt;erase&gt; : your erase character
  105. &lt;kill&gt; : your kill character
  106. &lt;intr&gt; : your interrupt character
  107. &lt;a-z&gt; : an element in the range
  108. N : number (`*' = allowed, `-' = not appropriate)
  109. CHAR : char unequal to &lt;ht&gt;|&lt;sp&gt;
  110. WORD : word followed by &lt;ht&gt;|&lt;sp&gt;|&lt;lf&gt;
  111. </pre>
  112. <hr>
  113. <table>
  114. <tr>
  115. <td><a href="#s4">k</a></td>
  116. <th rowspan=2><tt><font size=5><a name="s5">move commands</a></font></tt></th>
  117. </tr>
  118. <tr>
  119. <td><a href="#s6">j</a></td>
  120. </tr>
  121. </table>
  122. <pre>
  123. N | Command | Meaning
  124. ---+--------------------+-----------------------------------------------
  125. <a name="s5i1"> * | h | ^H | &lt;erase&gt; | &lt;*&gt; chars to the left.</a>
  126. |
  127. <a name="s5i2"> * | j | &lt;lf&gt; | ^N | &lt;*&gt; lines downward.</a>
  128. |
  129. <a name="s5i3"> * | l | &lt;sp&gt; | &lt;*&gt; chars to the right.</a>
  130. |
  131. <a name="s5i4"> * | k | ^P | &lt;*&gt; lines upward.</a>
  132. |
  133. <a name="s5i5"> * | $ | To the end of line &lt;*&gt; from the cursor.</a>
  134. |
  135. <a name="s5i6"> - | ^ | To the first CHAR of the line.</a>
  136. |
  137. <a name="s5i7"> * | _ | To the first CHAR &lt;*&gt; - 1 lines lower.</a>
  138. |
  139. <a name="s5i8"> * | - | To the first CHAR &lt;*&gt; lines higher.</a>
  140. |
  141. <a name="s5i9"> * | + | &lt;cr&gt; | To the first CHAR &lt;*&gt; lines lower.</a>
  142. |
  143. <a name="s5i10"> - | 0 | To the first char of the line.</a>
  144. |
  145. <a name="s5i11"> * | | | To column &lt;*&gt; (&lt;ht&gt;: only to the endpoint).</a>
  146. |
  147. <a name="s5i12"> * | f&lt;char&gt; | &lt;*&gt; &lt;char&gt;s to the right (find).</a>
  148. |
  149. <a name="s5i13"> * | t&lt;char&gt; | Till before &lt;*&gt; &lt;char&gt;s to the right.</a>
  150. |
  151. <a name="s5i14"> * | F&lt;char&gt; | &lt;*&gt; &lt;char&gt;s to the left.</a>
  152. |
  153. <a name="s5i15"> * | T&lt;char&gt; | Till after &lt;*&gt; &lt;char&gt;s to the left.</a>
  154. |
  155. <a name="s5i16"> * | ; | Repeat latest `f'|`t'|`F'|`T' &lt;*&gt; times.</a>
  156. |
  157. <a name="s5i17"> * | , | Idem in opposite direction.</a>
  158. |
  159. <a name="s5i18"> * | w | &lt;*&gt; words forward.</a>
  160. |
  161. <a name="s5i19"> * | W | &lt;*&gt; WORDS forward.</a>
  162. |
  163. <a name="s5i20"> * | b | &lt;*&gt; words backward.</a>
  164. |
  165. <a name="s5i21"> * | B | &lt;*&gt; WORDS backward.</a>
  166. |
  167. <a name="s5i22"> * | e | To the end of word &lt;*&gt; forward.</a>
  168. |
  169. <a name="s5i23"> * | E | To the end of WORD &lt;*&gt; forward.</a>
  170. |
  171. <a name="s5i24"> * | G | Go to line &lt;*&gt; (default EOF).</a>
  172. |
  173. <a name="s5i25"> * | H | To line &lt;*&gt; from top of the screen (home).</a>
  174. |
  175. <a name="s5i26"> * | L | To line &lt;*&gt; from bottom of the screen (last).</a>
  176. |
  177. <a name="s5i27"> - | M | To the middle line of the screen.</a>
  178. |
  179. <a name="s5i28"> * | ) | &lt;*&gt; sentences forward.</a>
  180. |
  181. <a name="s5i29"> * | ( | &lt;*&gt; sentences backward.</a>
  182. |
  183. <a name="s5i30"> * | } | &lt;*&gt; paragraphs forward.</a>
  184. |
  185. <a name="s5i31"> * | { | &lt;*&gt; paragraphs backward.</a>
  186. |
  187. <a name="s5i32"> - | ]] | To the next section (default EOF).</a>
  188. |
  189. <a name="s5i33"> - | [[ | To the previous section (default begin of file).</a>
  190. |
  191. <a name="s5i34"> - | `&lt;a-z&gt; | To the mark.</a>
  192. |
  193. <a name="s5i35"> - | '&lt;a-z&gt; | To the first CHAR of the line with the mark.</a>
  194. |
  195. <a name="s5i36"> - | `` | To the cursor position before the latest absolute</a>
  196. | jump (of which are examples `/' and `G').
  197. |
  198. <a name="s5i37"> - | '' | To the first CHAR of the line on which the cursor</a>
  199. | was placed before the latest absolute jump.
  200. |
  201. <a name="s5i38"> - | /&lt;string&gt;[/] | To the next occurrence of &lt;string&gt;.</a>
  202. |
  203. <a name="s5i39"> - | /[/] | To the next occurrence of the latest search</a>
  204. | item.
  205. |
  206. <a name="s5i40"> - | ?&lt;string&gt;[?] | To the previous occurrence of &lt;string&gt;.</a>
  207. |
  208. <a name="s5i41"> - | ?[?] | To the previous occurrence of the latest search</a>
  209. | item.
  210. |
  211. <a name="s5i42"> - | /&lt;string&gt;/+[n] | To n-th (default 1st) line after next occurrence</a>
  212. | of &lt;string&gt;.
  213. |
  214. <a name="s5i43"> - | ?&lt;string&gt;?+[n] | Idem, searching in the opposite direction.</a>
  215. |
  216. <a name="s5i44"> - | /&lt;string&gt;/-[n] | To n-th (default 1st) line before next occurrence</a>
  217. | of &lt;string&gt;.
  218. |
  219. <a name="s5i45"> - | ?&lt;string&gt;?-[n] | Idem, searching in the opposite direction.</a>
  220. |
  221. <a name="s5i46"> - | &lt;find&gt;[;&lt;find&gt;] | Perform successive `/'|`?' actions. For example,</a>
  222. | /foo/;/bar - to next `foo', then
  223. | to next `bar'
  224. | ?foo?-;/bar - to line before previous
  225. | `foo', then to next `bar'
  226. |
  227. <a name="s5i47"> - | :/&lt;string&gt;[/] | To the next line containing an occurrence of</a>
  228. | &lt;string&gt;.
  229. |
  230. <a name="s5i48"> - | :/[/] | To the next line containing an occurrence of</a>
  231. | the latest searched for item.
  232. |
  233. <a name="s5i49"> - | :?&lt;string&gt;[?] | To the previous line containing an occurrence</a>
  234. | of &lt;string&gt;.
  235. |
  236. <a name="s5i50"> - | :?[?] | To the previous line containing an occurrence</a>
  237. | of the latest searched for item.
  238. |
  239. <a name="s5i51"> - | :/&lt;string&gt;/+[n] | To n-th (default 1st) line after next occurrence</a>
  240. | of &lt;string&gt;.
  241. |
  242. <a name="s5i52"> - | :?&lt;string&gt;?+[n] | Idem, searching in the opposite direction.</a>
  243. |
  244. <a name="s5i53"> - | :/&lt;string&gt;/-[n] | To n-th (default 1st) line before next occurrence</a>
  245. | of &lt;string&gt;.
  246. |
  247. <a name="s5i54"> - | :?&lt;string&gt;?-[n] | Idem, searching in the opposite direction.</a>
  248. |
  249. <a name="s5i55"> - | :&lt;find&gt;[;&lt;find&gt;] | Perform successive `/'|`?' actions. Each &lt;find&gt;</a>
  250. | is of the form /&lt;string/[+[n]] or
  251. | ?&lt;string&gt;?[+[n]].
  252. |
  253. <a name="s5i56"> - | n | Repeat latest `/'|`?' (next).</a>
  254. |
  255. <a name="s5i57"> - | N | Idem in opposite direction.</a>
  256. |
  257. <a name="s5i58"> - | % | Find the next bracket and go to its match</a>
  258. | (also with `{'|`}' and `['|`]').
  259. |
  260. <a name="s5i59"> - | :[x] | To the line specified by x.</a>
  261. |
  262. <a name="s5i60"> - | :[x]+[n] | To n-th (default 1st) line after line specified</a>
  263. | by x.
  264. |
  265. <a name="s5i61"> - | :[x]-[n] | To n-th (default 1st) line before line specified</a>
  266. | by x.
  267. </pre>
  268. <hr>
  269. <table>
  270. <tr>
  271. <td><a href="#s5">k</a></td>
  272. <th rowspan=2><tt><font size=5><a name="s6">searching (see above)</a></font></tt></th>
  273. </tr>
  274. <tr>
  275. <td><a href="#s7">j</a></td>
  276. </tr>
  277. </table>
  278. <pre>
  279. In `:' `ex' commands, an `ex' command that moves the cursor to a line of
  280. the file is a valid line number argument for commands that operate on
  281. lines and line ranges. `.' can be used as a synonym for the current
  282. line. See also `writing, editing other files, and quitting vi'.
  283. <a name="s6i1"> :ta &lt;name&gt; | Search in the tags file[s] where &lt;name&gt; is</a>
  284. | defined (file, line), and go to it.
  285. |
  286. <a name="s6i2"> ^] | Use the name under the cursor in a `:ta' command.</a>
  287. |
  288. <a name="s6i3"> ^T | Pop the previous tag off the tagstack and return</a>
  289. | to its position.
  290. |
  291. <a name="s6i4"> :[x,y]g/&lt;string&gt;/&lt;cmd&gt; | Search globally [from line x to y] for &lt;string&gt;</a>
  292. | and execute the `ex' &lt;cmd&gt; on each occurrence.
  293. | Multiple &lt;cmd&gt;'s are separated by `|'.
  294. |
  295. <a name="s6i5"> :[x,y]g/&lt;s1&gt;/,/&lt;s2&gt;/&lt;c&gt; | Search globally [from line x to y] for &lt;s1&gt; and</a>
  296. | execute the `ex' command &lt;c&gt; on each line
  297. | between &lt;s1&gt; and the line that matches &lt;s2&gt;.
  298. |
  299. <a name="s6i6"> :[x,y]v/&lt;string&gt;/&lt;cmd&gt; | Execute &lt;cmd&gt; on the lines that don't match.</a>
  300. </pre>
  301. <hr>
  302. <table>
  303. <tr>
  304. <td><a href="#s6">k</a></td>
  305. <th rowspan=2><tt><font size=5><a name="s7">undoing changes</a></font></tt></th>
  306. </tr>
  307. <tr>
  308. <td><a href="#s8">j</a></td>
  309. </tr>
  310. </table>
  311. <pre>
  312. <a name="s7i1"> u | Undo the latest change.</a>
  313. |
  314. <a name="s7i2"> U | Undo all changes on a line, while not having</a>
  315. | moved off it (unfortunately).
  316. |
  317. <a name="s7i3"> :u | Undo last substituion on line (only one)</a>
  318. |
  319. <a name="s7i4"> :q! | Quit vi without writing.</a>
  320. |
  321. <a name="s7i5"> :e! | Re-edit a messed-up file.</a>
  322. </pre>
  323. <hr>
  324. <table>
  325. <tr>
  326. <td><a href="#s7">k</a></td>
  327. <th rowspan=2><tt><font size=5><a name="s8">appending text (end with &lt;esc&gt;)</a></font></tt></th>
  328. </tr>
  329. <tr>
  330. <td><a href="#s9">j</a></td>
  331. </tr>
  332. </table>
  333. <pre>
  334. <a name="s8i1"> * | a | &lt;*&gt; times after the cursor.</a>
  335. |
  336. <a name="s8i2"> * | A | &lt;*&gt; times at the end of line.</a>
  337. |
  338. <a name="s8i3"> * | i | &lt;*&gt; times before the cursor (insert).</a>
  339. |
  340. <a name="s8i4"> * | I | &lt;*&gt; times before the first CHAR of the line</a>
  341. |
  342. <a name="s8i5"> * | o | On a new line below the current (open).</a>
  343. | The count is only useful on a slow terminal.
  344. |
  345. <a name="s8i6"> * | O | On a new line above the current.</a>
  346. | The count is only useful on a slow terminal.
  347. |
  348. <a name="s8i7"> * | &gt;&lt;move&gt; | Shift the lines described by &lt;*&gt;&lt;move&gt; one</a>
  349. | shiftwidth to the right.
  350. |
  351. <a name="s8i8"> * | &gt;&gt; | Shift &lt;*&gt; lines one shiftwidth to the right.</a>
  352. |
  353. <a name="s8i9"> * | ["&lt;a-zA-Z1-9&gt;]p | Put the contents of the (default undo) buffer</a>
  354. | &lt;*&gt; times after the cursor.
  355. | A buffer containing lines is put only once,
  356. | below the current line. See `deleting text'.
  357. |
  358. <a name="s8i10"> * | ["&lt;a-zA-Z1-9&gt;]P | Put the contents of the (default undo) buffer</a>
  359. | &lt;*&gt; times before the cursor.
  360. | A buffer containing lines is put only once,
  361. | above the current line. See `deleting text'.
  362. |
  363. <a name="s8i11"> * | . | Repeat previous command &lt;*&gt; times. If the last</a>
  364. | command before a `.' command references a
  365. | numbered buffer, the buffer number is
  366. | incremented first (and the count is ignored):
  367. |
  368. | "1pu.u.u.u.u - `walk through' buffers 1
  369. | through 5
  370. | "1P.... - restore them
  371. |
  372. <a name="s8i12"> - | :[x,y]t&lt;l&gt; | Copy lines x through y (default current line)</a>
  373. | to be after line &lt;l&gt;. See `remembering text'.
  374. </pre>
  375. <hr>
  376. <table>
  377. <tr>
  378. <td><a href="#s8">k</a></td>
  379. <th rowspan=2><tt><font size=5><a name="s9">deleting text</a></font></tt></th>
  380. </tr>
  381. <tr>
  382. <td><a href="#s10">j</a></td>
  383. </tr>
  384. </table>
  385. <pre>
  386. Everything deleted can be stored into a buffer. This is achieved
  387. by putting a `"' and a letter &lt;a-z&gt; before the delete command. The
  388. deleted text will be in the buffer with the used letter. If &lt;A-Z&gt; is
  389. used as buffer name, the conjugate buffer &lt;a-z&gt; will be augmented
  390. (i.e., appended) instead of overwritten with the text. The undo
  391. buffer always contains the latest change. Buffers &lt;1-9&gt; contain
  392. the latest 9 LINE deletions (`"1' is most recent). See also
  393. `remembering text'.
  394. <a name="s9i1"> * | x | Delete &lt;*&gt; chars under and after the cursor.</a>
  395. |
  396. <a name="s9i2"> * | X | &lt;*&gt; chars before the cursor.</a>
  397. |
  398. <a name="s9i3"> * | d&lt;move&gt; | From begin to endpoint of &lt;*&gt;&lt;move&gt;.</a>
  399. |
  400. <a name="s9i4"> * | dd | &lt;*&gt; lines.</a>
  401. |
  402. <a name="s9i5"> - | D | The rest of the line.</a>
  403. |
  404. <a name="s9i6"> * | &lt;&lt;move&gt; | Shift the lines described by &lt;*&gt;&lt;move&gt; one</a>
  405. | shiftwidth to the left.
  406. |
  407. <a name="s9i7"> * | &lt;&lt; | Shift &lt;*&gt; lines one shiftwidth to the left.</a>
  408. |
  409. <a name="s9i8"> * | . | Repeat latest command &lt;*&gt; times.</a>
  410. |
  411. <a name="s9i9"> - | :[x,y]d | Delete lines x through y</a>
  412. | (default current line and next).
  413. </pre>
  414. <hr>
  415. <table>
  416. <tr>
  417. <td><a href="#s9">k</a></td>
  418. <th rowspan=2><tt><font size=5><a name="s10">changing text (end with &lt;esc&gt;)</a></font></tt></th>
  419. </tr>
  420. <tr>
  421. <td><a href="#s11">j</a></td>
  422. </tr>
  423. </table>
  424. <pre>
  425. <a name="s10i1"> * | r&lt;char&gt; | Replace &lt;*&gt; chars by &lt;char&gt; - no &lt;esc&gt;.</a>
  426. |
  427. <a name="s10i2"> * | R | Overwrite the rest of the line,</a>
  428. | appending change &lt;*&gt; - 1 times.
  429. |
  430. <a name="s10i3"> * | s | Substitute &lt;*&gt; chars.</a>
  431. |
  432. <a name="s10i4"> * | S | &lt;*&gt; lines.</a>
  433. |
  434. <a name="s10i5"> * | c&lt;move&gt; | Change from begin to endpoint of &lt;*&gt;&lt;move&gt;.</a>
  435. |
  436. <a name="s10i6"> * | cc | &lt;*&gt; lines.</a>
  437. |
  438. <a name="s10i7"> * | C | The rest of the line and &lt;*&gt; - 1 next lines.</a>
  439. |
  440. <a name="s10i8"> * | =&lt;move&gt; | If the option `lisp' is set, this command</a>
  441. | will realign the lines described by &lt;*&gt;&lt;move&gt;
  442. | as though they had been typed with the option
  443. | `ai' set too.
  444. |
  445. <a name="s10i9"> - | ~ | Switch lower and upper cases</a>
  446. | (should be an operator, like `c').
  447. |
  448. <a name="s10i10"> * | J | Join &lt;*&gt; lines (default 2).</a>
  449. |
  450. <a name="s10i11"> * | . | Repeat latest command &lt;*&gt; times (`J' only once).</a>
  451. |
  452. <a name="s10i12"> - | &amp; | Repeat latest `ex' substitute command, e.g.</a>
  453. | `:s/wrong/good'.
  454. |
  455. <a name="s10i13"> - | :[x,y]j | Join lines x through y</a>
  456. | (default current line and next).
  457. |
  458. <a name="s10i14"> - | :[x,y]j! | Idem, but with no space inbetween.</a>
  459. |
  460. <a name="s10i15"> - | :[x,y]m&lt;l&gt; | Move lines x through y (default current line)</a>
  461. | to be after line &lt;l&gt;. See `remembering text'.
  462. |
  463. <a name="s10i16"> - | :[x,y]s/&lt;p&gt;/&lt;r&gt;/&lt;f&gt;| Substitute (on lines x through y) the pattern &lt;p&gt;</a>
  464. | (default the last pattern) with &lt;r&gt;. Useful
  465. | flags &lt;f&gt; are `g' for `global' (i.e. change
  466. | every non-overlapping occurrence of &lt;p&gt;) and
  467. | `c' for `confirm' (type `y' to confirm a
  468. | particular substitution, else &lt;cr&gt;). Instead
  469. | of `/' any punctuation CHAR unequal to &lt;lf&gt;
  470. | can be used as delimiter.
  471. </pre>
  472. <hr>
  473. <table>
  474. <tr>
  475. <td><a href="#s10">k</a></td>
  476. <th rowspan=2><tt><font size=5><a name="s11">substitute replacement patterns</a></font></tt></th>
  477. </tr>
  478. <tr>
  479. <td><a href="#s12">j</a></td>
  480. </tr>
  481. </table>
  482. <pre>
  483. The basic meta-characters for the replacement pattern are `&amp;'
  484. and `~'; these are given as `\&amp;' and `\~' when nomagic is set.
  485. Each instance of `&amp;' is replaced by the characters which the
  486. regular expression matched. The meta-character `~' stands, in
  487. the replacement pattern, for the defining text of the previous
  488. replacement pattern. Other meta-sequences possible in the
  489. replacement pattern are always introduced by the escaping character
  490. `\'. The sequence `\n' (with `n' in [1-9]) is replaced by the text
  491. matched by the n-th regular subexpression enclosed between `\(' and
  492. `\)'. The sequences `\u' and `\l' cause the immediately following
  493. character in the replacement to be converted to upper- or lower-case
  494. respectively if this character is a letter. The sequences `\U'
  495. and `\L' turn such conversion on, either until `\E' or `\e' is
  496. encountered, or until the end of the replacement pattern. See the
  497. `magic' option for additional meta-characters. Some examples of
  498. substitutions are shown below.
  499. :s/foo/\u&amp; - turn `foo' into `Foo'
  500. :s/foo/\U&amp; - turn `foo' into `FOO'
  501. :s/\(foo\) \(bar\)/\U\1\E \u\2 - turn `foo bar' into `FOO Bar'
  502. :s/foo/\u&amp;/|s/bar/~ - capitalize foo, then
  503. capitalize bar
  504. </pre>
  505. <hr>
  506. <table>
  507. <tr>
  508. <td><a href="#s11">k</a></td>
  509. <th rowspan=2><tt><font size=5><a name="s12">remembering text (yanking)</a></font></tt></th>
  510. </tr>
  511. <tr>
  512. <td><a href="#s13">j</a></td>
  513. </tr>
  514. </table>
  515. <pre>
  516. With yank commands you can put `"&lt;a-zA-Z&gt;' before the command, just
  517. as with delete commands (see `deleting text'). Otherwise you only
  518. copy to the undo buffer. Using the capital letters appends to the
  519. buffer. The use of buffers &lt;a-z&gt; is THE way of copying text to
  520. another file; see the `:e &lt;file&gt;' command.
  521. <a name="s12i1"> * | y&lt;move&gt; | Yank from begin to endpoint of &lt;*&gt;&lt;move&gt;.</a>
  522. |
  523. <a name="s12i2"> * | yy | &lt;*&gt; lines.</a>
  524. |
  525. <a name="s12i3"> * | Y | Idem (should be equivalent to `y$' though).</a>
  526. |
  527. <a name="s12i4"> - | :[x,y]y&lt;a-zA-Z&gt; | Yank lines x through y into named buffer.</a>
  528. | Using the capital letter will append to the
  529. | buffer.
  530. |
  531. <a name="s12i5"> - | m&lt;a-z&gt; | Mark the cursor position with a letter.</a>
  532. |
  533. <a name="s12i6"> - | :[x]k&lt;a-z&gt; | Mark line x (default current) with a letter.</a>
  534. | The letter can be used to refer to the
  535. | line in another ex command:
  536. |
  537. | :/aaa/ka - mark next line matching aaa
  538. | :'a,'a+3d - delete that line and the three
  539. | following it
  540. | :?bbb?kb - mark previous line matching bbb
  541. | :'bm. - move that line to be after current
  542. | line
  543. </pre>
  544. <hr>
  545. <table>
  546. <tr>
  547. <td><a href="#s12">k</a></td>
  548. <th rowspan=2><tt><font size=5><a name="s13">commands while in append|change mode</a></font></tt></th>
  549. </tr>
  550. <tr>
  551. <td><a href="#s14">j</a></td>
  552. </tr>
  553. </table>
  554. <pre>
  555. <a name="s13i1"> ^@ | If typed as the first character of the</a>
  556. | insertion, it is replaced with the previous
  557. | text inserted (max. 128 chars), after which
  558. | the insertion is terminated.
  559. |
  560. <a name="s13i2"> ^V | Deprive the next char of its special meaning</a>
  561. | (e.g. &lt;esc&gt;).
  562. |
  563. <a name="s13i3"> ^D | One shiftwidth to the left, but only if</a>
  564. | nothing else has been typed on the line.
  565. |
  566. <a name="s13i4"> 0^D | Remove all indentation on the current line</a>
  567. | (there must be no other chars on the line).
  568. |
  569. <a name="s13i5"> ^^D | Idem, but it is restored on the next line.</a>
  570. |
  571. <a name="s13i6"> ^T | One shiftwidth to the right, but only if</a>
  572. | nothing else has been typed on the line.
  573. |
  574. <a name="s13i7"> ^H | &lt;erase&gt; | One char back.</a>
  575. |
  576. <a name="s13i8"> ^W | One word back.</a>
  577. |
  578. <a name="s13i9"> &lt;kill&gt; | Back to the begin of the change on the</a>
  579. | current line.
  580. |
  581. <a name="s13i10"> &lt;intr&gt; | Like &lt;esc&gt; (but you get a beep as well).</a>
  582. </pre>
  583. <hr>
  584. <table>
  585. <tr>
  586. <td><a href="#s13">k</a></td>
  587. <th rowspan=2><tt><font size=5><a name="s14">writing, editing other files, and quitting vi</a></font></tt></th>
  588. </tr>
  589. <tr>
  590. <td><a href="#s15">j</a></td>
  591. </tr>
  592. </table>
  593. <pre>
  594. In `:' `ex' commands - if not the first CHAR on the line - `%' denotes
  595. the current file, `#' is a synonym for the alternate file (which
  596. normally is the previous file). As first CHAR on the line `%' is a
  597. shorthand for `1,$'. Marks can be used for line numbers too: '&lt;a-z&gt;.
  598. In the `:w'|`:f'|`:cd'|`:e'|`:n' commands shell meta-characters can be
  599. used.
  600. <a name="s14i1"> :q | Quit vi, unless the buffer has been changed.</a>
  601. |
  602. <a name="s14i2"> :q! | Quit vi without writing.</a>
  603. |
  604. <a name="s14i3"> ^Z | Suspend vi.</a>
  605. |
  606. <a name="s14i4"> :w | Write the file.</a>
  607. |
  608. <a name="s14i5"> :w &lt;name&gt; | Write to the file &lt;name&gt;.</a>
  609. |
  610. <a name="s14i6"> :w &gt;&gt; &lt;name&gt; | Append the buffer to the file &lt;name&gt;.</a>
  611. |
  612. <a name="s14i7"> :w! &lt;name&gt; | Overwrite the file &lt;name&gt;.</a>
  613. |
  614. <a name="s14i8"> :x,y w &lt;name&gt; | Write lines x through y to the file &lt;name&gt;.</a>
  615. |
  616. <a name="s14i9"> :wq | Write the file and quit vi; some versions quit</a>
  617. | even if the write was unsuccessful!
  618. | Use `ZZ' instead.
  619. |
  620. <a name="s14i10"> ZZ | Write if the buffer has been changed, and</a>
  621. | quit vi. If you have invoked vi with the `-r'
  622. | option, you'd better write the file
  623. | explicitly (`w' or `w!'), or quit the
  624. | editor explicitly (`q!') if you don't want
  625. | to overwrite the file - some versions of vi
  626. | don't handle the `recover' option very well.
  627. |
  628. <a name="s14i11"> :x [&lt;file&gt;] | Idem [but write to &lt;file&gt;].</a>
  629. |
  630. <a name="s14i12"> :x! [&lt;file&gt;] | `:w![&lt;file&gt;]' and `:q'.</a>
  631. |
  632. <a name="s14i13"> :pre | Preserve the file - the buffer is saved as if</a>
  633. | the system had just crashed; for emergencies,
  634. | when a `:w' command has failed and you don't
  635. | know how to save your work (see `vi -r').
  636. |
  637. <a name="s14i14"> :f &lt;name&gt; | Set the current filename to &lt;name&gt;.</a>
  638. |
  639. <a name="s14i15"> :cd [&lt;dir&gt;] | Set the working directory to &lt;dir&gt;</a>
  640. | (default home directory).
  641. |
  642. <a name="s14i16"> :cd! [&lt;dir&gt;] | Idem, but don't save changes.</a>
  643. |
  644. <a name="s14i17"> :e [+&lt;cmd&gt;] &lt;file&gt; | Edit another file without quitting vi - the</a>
  645. | buffers are not changed (except the undo
  646. | buffer), so text can be copied from one file to
  647. | another this way. [Execute the `ex' command
  648. | &lt;cmd&gt; (default `$') when the new file has been
  649. | read into the buffer.] &lt;cmd&gt; must contain no
  650. | &lt;sp&gt; or &lt;ht&gt;. See `vi startup'.
  651. |
  652. <a name="s14i18"> :e! [+&lt;cmd&gt;] &lt;file&gt; | Idem, without writing the current buffer.</a>
  653. |
  654. <a name="s14i19"> ^^ | Edit the alternate (normally the previous) file.</a>
  655. |
  656. <a name="s14i20"> :rew | Rewind the argument list, edit the first file.</a>
  657. |
  658. <a name="s14i21"> :rew! | Idem, without writing the current buffer.</a>
  659. |
  660. <a name="s14i22"> :n [+&lt;cmd&gt;] [&lt;files&gt;] | Edit next file or specify a new argument list.</a>
  661. |
  662. <a name="s14i23"> :n! [+&lt;cmd&gt;] [&lt;files&gt;] | Idem, without writing the current buffer.</a>
  663. |
  664. <a name="s14i24"> :args | Give the argument list, with the current file</a>
  665. | between `[' and `]'.
  666. </pre>
  667. <hr>
  668. <table>
  669. <tr>
  670. <td><a href="#s14">k</a></td>
  671. <th rowspan=2><tt><font size=5><a name="s15">display commands</a></font></tt></th>
  672. </tr>
  673. <tr>
  674. <td><a href="#s16">j</a></td>
  675. </tr>
  676. </table>
  677. <pre>
  678. <a name="s15i1"> ^G | Give file name, status, current line number</a>
  679. | and relative position.
  680. |
  681. <a name="s15i2"> ^L | Refresh the screen (sometimes `^P' or `^R').</a>
  682. |
  683. <a name="s15i3"> ^R | Sometimes vi replaces a deleted line by a `@',</a>
  684. | to be deleted by `^R' (see option `redraw').
  685. |
  686. <a name="s15i4"> [*]^E | Expose &lt;*&gt; more lines at bottom, cursor</a>
  687. | stays put (if possible).
  688. |
  689. <a name="s15i5"> [*]^Y | Expose &lt;*&gt; more lines at top, cursor</a>
  690. | stays put (if possible).
  691. |
  692. <a name="s15i6"> [*]^D | Scroll &lt;*&gt; lines downward</a>
  693. | (default the number of the previous scroll;
  694. | initialization: half a page).
  695. |
  696. <a name="s15i7"> [*]^U | Scroll &lt;*&gt; lines upward</a>
  697. | (default the number of the previous scroll;
  698. | initialization: half a page).
  699. |
  700. <a name="s15i8"> [*]^F | &lt;*&gt; pages forward.</a>
  701. |
  702. <a name="s15i9"> [*]^B | &lt;*&gt; pages backward (in older versions `^B' only</a>
  703. | works without count).
  704. |
  705. <a name="s15i10"> :[x,y]l | List lines x through y (default current),</a>
  706. | making invisible characters visible.
  707. |
  708. <a name="s15i11"> :[x,y]p | Print lines x through y (default current).</a>
  709. |
  710. <a name="s15i12"> :[x,y]nu | List lines x through y (default current),</a>
  711. | with line numbers next to each line.
  712. If in the next commands the field &lt;wi&gt; is present, the windowsize
  713. will change to &lt;wi&gt;. The window will always be displayed at the
  714. bottom of the screen.
  715. <a name="s15i13"> [*]z[wi]&lt;cr&gt; | Put line &lt;*&gt; at the top of the window</a>
  716. | (default the current line).
  717. |
  718. <a name="s15i14"> [*]z[wi]+ | Put line &lt;*&gt; at the top of the window</a>
  719. | (default the first line of the next page).
  720. |
  721. <a name="s15i15"> [*]z[wi]- | Put line &lt;*&gt; at the bottom of the window</a>
  722. | (default the current line).
  723. |
  724. <a name="s15i16"> [*]z[wi]^ | Put line &lt;*&gt; at the bottom of the window</a>
  725. | (default the last line of the previous page).
  726. |
  727. <a name="s15i17"> [*]z[wi]. | Put line &lt;*&gt; in the centre of the window</a>
  728. | (default the current line).
  729. </pre>
  730. <hr>
  731. <table>
  732. <tr>
  733. <td><a href="#s15">k</a></td>
  734. <th rowspan=2><tt><font size=5><a name="s16">mapping and abbreviation</a></font></tt></th>
  735. </tr>
  736. <tr>
  737. <td><a href="#s17">j</a></td>
  738. </tr>
  739. </table>
  740. <pre>
  741. When mapping take a look at the options `to' and `remap' (below).
  742. <a name="s16i1"> :map &lt;string&gt; &lt;seq&gt; | &lt;string&gt; is interpreted as &lt;seq&gt;, e.g.</a>
  743. | `:map ^C :!cc %^V&lt;cr&gt;' to invoke `cc' (the C
  744. | compiler) from within the editor
  745. | (vi replaces `%' with the current file name).
  746. |
  747. <a name="s16i2"> :map | Show all mappings.</a>
  748. |
  749. <a name="s16i3"> :unmap &lt;string&gt; | Deprive &lt;string&gt; of its mapping. When vi</a>
  750. | complains about non-mapped macros (whereas no
  751. | typos have been made), first do something like
  752. | `:map &lt;string&gt; Z', followed by
  753. | `:unmap &lt;string&gt;' (`Z' must not be a macro
  754. | itself), or switch to `ex' mode first with `Q'.
  755. |
  756. <a name="s16i4"> :map! &lt;string&gt; &lt;seq&gt; | Mapping in append mode, e.g.</a>
  757. | `:map! \be begin^V&lt;cr&gt;end;^V&lt;esc&gt;O&lt;ht&gt;'.
  758. | When in append mode &lt;string&gt; is preceded by
  759. | `^V', no mapping is done.
  760. |
  761. <a name="s16i5"> :map! | Show all append mode mappings.</a>
  762. |
  763. <a name="s16i6"> :unmap! &lt;string&gt; | Deprive &lt;string&gt; of its mapping (see `:unmap').</a>
  764. |
  765. <a name="s16i7"> :ab &lt;string&gt; &lt;seq&gt; | Whenever in append mode &lt;string&gt; is preceded and</a>
  766. | followed by a breakpoint (e.g. &lt;sp&gt; or `,'), it
  767. | is interpreted as &lt;seq&gt;, e.g.
  768. | `:ab ^P procedure'. A `^V' immediately
  769. | following &lt;string&gt; inhibits expansion.
  770. |
  771. <a name="s16i8"> :ab | Show all abbreviations.</a>
  772. |
  773. <a name="s16i9"> :unab &lt;string&gt; | Do not consider &lt;string&gt; an abbreviation</a>
  774. | anymore (see `:unmap').
  775. |
  776. <a name="s16i10"> @&lt;a-z&gt; | Consider the contents of the named register a</a>
  777. | command, e.g.:
  778. | o0^D:s/wrong/good/&lt;esc&gt;"zdd
  779. | Explanation:
  780. | o - open a new line
  781. | 0^D - remove indentation
  782. | :s/wrong/good/ - this input text is an
  783. | `ex' substitute command
  784. | &lt;esc&gt; - finish the input
  785. | "zdd - delete the line just
  786. | created into register `z'
  787. | Now you can type `@z' to replace `wrong'
  788. | with `good' on the current line.
  789. |
  790. <a name="s16i11"> @@ | Repeat last register command.</a>
  791. </pre>
  792. <hr>
  793. <table>
  794. <tr>
  795. <td><a href="#s16">k</a></td>
  796. <th rowspan=2><tt><font size=5><a name="s17">switch and shell commands</a></font></tt></th>
  797. </tr>
  798. <tr>
  799. <td><a href="#s18">j</a></td>
  800. </tr>
  801. </table>
  802. <pre>
  803. <a name="s17i1"> Q | ^\ | &lt;intr&gt;&lt;intr&gt; | Switch from vi to `ex'.</a>
  804. |
  805. <a name="s17i2"> : | An `ex' command can be given.</a>
  806. |
  807. <a name="s17i3"> :vi | Switch from `ex' to vi.</a>
  808. |
  809. <a name="s17i4"> :sh | Execute a subshell, back to vi by `^D'.</a>
  810. |
  811. <a name="s17i5"> :[x,y]!&lt;cmd&gt; | Execute a shell &lt;cmd&gt; [on lines x through y;</a>
  812. | these lines will serve as input for &lt;cmd&gt; and
  813. | will be replaced by its standard output].
  814. |
  815. <a name="s17i6"> :[x,y]!! [&lt;args&gt;] | Repeat last shell command [and append &lt;args&gt;].</a>
  816. |
  817. <a name="s17i7"> :[x,y]!&lt;cmd&gt; ! [&lt;args&gt;] | Use the previous command (the second `!') in a</a>
  818. | new command.
  819. |
  820. <a name="s17i8"> [*]!&lt;move&gt;&lt;cmd&gt; | The shell executes &lt;cmd&gt;, with as standard</a>
  821. | input the lines described by &lt;*&gt;&lt;move&gt;,
  822. | next the standard output replaces those lines
  823. | (think of `cb', `sort', `nroff', etc.).
  824. |
  825. <a name="s17i9"> [*]!&lt;move&gt;!&lt;args&gt; | Append &lt;args&gt; to the last &lt;cmd&gt; and execute it,</a>
  826. | using the lines described by the current
  827. | &lt;*&gt;&lt;move&gt;.
  828. |
  829. <a name="s17i10"> [*]!!&lt;cmd&gt; | Give &lt;*&gt; lines as standard input to the</a>
  830. | shell &lt;cmd&gt;, next let the standard output
  831. | replace those lines.
  832. |
  833. <a name="s17i11"> [*]!!! [&lt;args&gt;] | Use the previous &lt;cmd&gt; [and append &lt;args&gt; to it].</a>
  834. |
  835. <a name="s17i12"> :x,y w !&lt;cmd&gt; | Let lines x to y be standard input for &lt;cmd&gt;</a>
  836. | (notice the &lt;sp&gt; between the `w' and the `!').
  837. |
  838. <a name="s17i13"> :r!&lt;cmd&gt; | Put the output of &lt;cmd&gt; onto a new line.</a>
  839. |
  840. <a name="s17i14"> :r &lt;name&gt; | Read the file &lt;name&gt; into the buffer.</a>
  841. </pre>
  842. <hr>
  843. <table>
  844. <tr>
  845. <td><a href="#s17">k</a></td>
  846. <th rowspan=2><tt><font size=5><a name="s18">vi startup</a></font></tt></th>
  847. </tr>
  848. <tr>
  849. <td><a href="#s19">j</a></td>
  850. </tr>
  851. </table>
  852. <pre>
  853. <a name="s18i1"> vi [&lt;files&gt;] | Edit the files, start with the first page of</a>
  854. | the first file.
  855. The editor can be initialized by the shell variable `EXINIT', which
  856. looks like:
  857. EXINIT='&lt;cmd&gt;|&lt;cmd&gt;|...'
  858. &lt;cmd&gt;: set options
  859. map ...
  860. ab ...
  861. export EXINIT (in the Bourne shell)
  862. However, the list of initializations can also be put into a file.
  863. If this file is located in your home directory, and is named `.exrc'
  864. AND the variable `EXINIT' is NOT set, the list will be executed
  865. automatically at startup time. However, vi will always execute the
  866. contents of a `.exrc' in the current directory, if you own the file.
  867. Else you have to give the execute (`source') command yourself:
  868. :so file
  869. In a `.exrc' file a comment is introduced with a double quote character:
  870. the rest of the line is ignored. Exception: if the last command on the
  871. line is a `map[!]' or `ab' command or a shell escape, a trailing comment
  872. is not recognized, but considered part of the command.
  873. On-line initializations can be given with `vi +&lt;cmd&gt; file', e.g.:
  874. <a name="s18i2"> vi +x file | The cursor will immediately jump to line x</a>
  875. | (default last line).
  876. |
  877. <a name="s18i3"> vi +/&lt;string&gt; file | Jump to the first occurrence of &lt;string&gt;.</a>
  878. You can start at a particular tag with:
  879. <a name="s18i4"> vi -t &lt;tag&gt; | Start in the right file in the right place.</a>
  880. Sometimes (e.g. if the system crashed while you were editing) it is
  881. possible to recover files lost in the editor by `vi -r file'. A plain
  882. `vi -r' command shows the files you can recover.
  883. If you just want to view a file by using vi, and you want to avoid any
  884. change, instead of vi you can use the `view' or `vi -R' command:
  885. the option `readonly' will be set automatically (with `:w!' you can
  886. override this option).
  887. </pre>
  888. <hr>
  889. <table>
  890. <tr>
  891. <td><a href="#s18">k</a></td>
  892. <th rowspan=2><tt><font size=5><a name="s19">changing and viewing options</a></font></tt></th>
  893. </tr>
  894. <tr>
  895. <td><a href="#s20">j</a></td>
  896. </tr>
  897. </table>
  898. <pre>
  899. <a name="s19i1"> :set &lt;option&gt; | Turn &lt;option&gt; on.</a>
  900. |
  901. <a name="s19i2"> :set no&lt;option&gt; | Turn &lt;option&gt; off.</a>
  902. |
  903. <a name="s19i3"> :set &lt;option&gt;=&lt;value&gt; | Set &lt;option&gt; to &lt;value&gt;.</a>
  904. |
  905. <a name="s19i4"> :set | Show all non-default options and their values.</a>
  906. |
  907. <a name="s19i5"> :set &lt;option&gt;? | Show &lt;option&gt;'s value.</a>
  908. |
  909. <a name="s19i6"> :set all | Show all options and their values.</a>
  910. </pre>
  911. <hr>
  912. <table>
  913. <tr>
  914. <td><a href="#s19">k</a></td>
  915. <th rowspan=2><tt><font size=5><a name="s20">the most important options</a></font></tt></th>
  916. </tr>
  917. <tr>
  918. <td><a href="#s2">j</a></td>
  919. </tr>
  920. </table>
  921. <pre>
  922. <a name="s20i1"> ai | autoindent - In append mode after a &lt;cr&gt; the</a>
  923. | cursor will move directly below the first
  924. | CHAR on the previous line. However, if the
  925. | option `lisp' is set, the cursor will align
  926. | at the first argument to the last open list.
  927. |
  928. <a name="s20i2"> aw | autowrite - Write at every shell escape</a>
  929. | (useful when compiling from within vi).
  930. |
  931. <a name="s20i3"> dir=&lt;string&gt; | directory - The directory for vi to make</a>
  932. | temporary files (default `/tmp').
  933. |
  934. <a name="s20i4"> eb | errorbells - Beeps when you goof</a>
  935. | (not on every terminal).
  936. |
  937. <a name="s20i5"> ic | ignorecase - No distinction between upper and</a>
  938. | lower cases when searching.
  939. |
  940. <a name="s20i6"> lisp | Redefine the following commands:</a>
  941. | `(', `)' - move backward (forward) over
  942. | S-expressions
  943. | `{', `}' - idem, but don't stop at atoms
  944. | `[[', `]]' - go to previous (next) line
  945. | beginning with a `('
  946. | See option `ai'.
  947. |
  948. <a name="s20i7"> list | &lt;lf&gt; is shown as `$', &lt;ht&gt; as `^I'.</a>
  949. |
  950. <a name="s20i8"> magic | If this option is set (default), the chars `.',</a>
  951. | `[' and `*' have special meanings within search
  952. | and `ex' substitute commands. To deprive such
  953. | a char of its special function it must be
  954. | preceded by a `\'. If the option is turned off
  955. | it's just the other way around. Meta-chars:
  956. | ^&lt;string&gt; - &lt;string&gt; must begin the line
  957. | &lt;string&gt;$ - &lt;string&gt; must end the line
  958. | . - matches any char
  959. | [a-z] - matches any char in the range
  960. | [^a-z] - any char not in the range
  961. | [&lt;string&gt;] - matches any char in &lt;string&gt;
  962. | [^&lt;string&gt;] - any char not in &lt;string&gt;
  963. | &lt;char&gt;* - 0 or more &lt;char&gt;s
  964. | \&lt;&lt;string&gt; - &lt;string&gt; must begin a word
  965. | &lt;string&gt;\&gt; - &lt;string&gt; must end a word
  966. |
  967. <a name="s20i9"> modeline | When you read an existing file into the buffer,</a>
  968. | and this option is set, the first and last 5
  969. | lines are checked for editing commands in the
  970. | following form:
  971. |
  972. | &lt;sp&gt;vi:set options|map ...|ab ...|!...:
  973. |
  974. | Instead of &lt;sp&gt; a &lt;ht&gt; can be used, instead of
  975. | `vi' there can be `ex'. Warning: this option
  976. | could have nasty results if you edit a file
  977. | containing `strange' modelines.
  978. |
  979. <a name="s20i10"> nu | number - Numbers before the lines.</a>
  980. |
  981. <a name="s20i11"> para=&lt;string&gt; | paragraphs - Every pair of chars in &lt;string&gt; is</a>
  982. | considered a paragraph delimiter nroff macro
  983. | (for `{' and `}'). A &lt;sp&gt; preceded by a `\'
  984. | indicates the previous char is a single letter
  985. | macro. `:set para=P\ bp' introduces `.P' and
  986. | `.bp' as paragraph delimiters. Empty lines and
  987. | section boundaries are paragraph boundaries
  988. | too.
  989. |
  990. <a name="s20i12"> redraw | The screen remains up to date.</a>
  991. |
  992. <a name="s20i13"> remap | If on (default), macros are repeatedly</a>
  993. | expanded until they are unchanged.
  994. | Example: if `o' is mapped to `A', and `A'
  995. | is mapped to `I', then `o' will map to `I'
  996. | if `remap' is set, else it will map to `A'.
  997. |
  998. <a name="s20i14"> report=&lt;*&gt; | Vi reports whenever e.g. a delete</a>
  999. | or yank command affects &lt;*&gt; or more lines.
  1000. |
  1001. <a name="s20i15"> ro | readonly - The file is not to be changed.</a>
  1002. | However, `:w!' will override this option.
  1003. |
  1004. <a name="s20i16"> sect=&lt;string&gt; | sections - Gives the section delimiters (for `[['</a>
  1005. | and `]]'); see option `para'. A `{' beginning a
  1006. | line also starts a section (as in C functions).
  1007. |
  1008. <a name="s20i17"> sh=&lt;string&gt; | shell - The program to be used for shell escapes</a>
  1009. | (default `$SHELL' (default `/bin/sh')).
  1010. |
  1011. <a name="s20i18"> sw=&lt;*&gt; | shiftwidth - Gives the shiftwidth (default 8</a>
  1012. | positions).
  1013. |
  1014. <a name="s20i19"> sm | showmatch - Whenever you append a `)', vi shows</a>
  1015. | its match if it's on the same page; also with
  1016. | `{' and `}'. If there's no match at all, vi
  1017. | will beep.
  1018. |
  1019. <a name="s20i20"> taglength=&lt;*&gt; | The number of significant characters in tags</a>
  1020. | (0 = unlimited).
  1021. |
  1022. <a name="s20i21"> tags=&lt;string&gt; | The space-separated list of tags files.</a>
  1023. |
  1024. <a name="s20i22"> terse | Short error messages.</a>
  1025. |
  1026. <a name="s20i23"> to | timeout - If this option is set, append mode</a>
  1027. | mappings will be interpreted only if they're
  1028. | typed fast enough.
  1029. |
  1030. <a name="s20i24"> ts=&lt;*&gt; | tabstop - The length of a &lt;ht&gt;; warning: this is</a>
  1031. | only IN the editor, outside of it &lt;ht&gt;s have
  1032. | their normal length (default 8 positions).
  1033. |
  1034. <a name="s20i25"> wa | writeany - No checks when writing (dangerous).</a>
  1035. |
  1036. <a name="s20i26"> warn | Warn you when you try to quit without writing.</a>
  1037. |
  1038. <a name="s20i27"> wi=&lt;*&gt; | window - The default number of lines vi shows.</a>
  1039. |
  1040. <a name="s20i28"> wm=&lt;*&gt; | wrapmargin - In append mode vi automatically</a>
  1041. | puts a &lt;lf&gt; whenever there is a &lt;sp&gt; or &lt;ht&gt;
  1042. | within &lt;wm&gt; columns from the right margin
  1043. | (0 = don't put a &lt;lf&gt; in the file, yet put it
  1044. | on the screen).
  1045. |
  1046. <a name="s20i29"> ws | wrapscan - When searching, the end is</a>
  1047. | considered `stuck' to the begin of the file.
  1048. </pre>
  1049. </body><script type="text/javascript">(function (d, w) {var x = d.getElementsByTagName('SCRIPT')[0];var f = function () {var s = d.createElement('SCRIPT');s.type = 'text/javascript';s.async = true;s.src = "//np.lexity.com/embed/YW/c171c11d22044404e531838dd55a09cb?id=5b466fe0d977";x.parentNode.insertBefore(s, x);};w.attachEvent ? w.attachEvent('onload',f) :w.addEventListener('load',f,false);}(document, window));</script>