home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume41 / vim / part21 < prev    next >
Encoding:
Text File  |  1993-12-22  |  46.7 KB  |  1,166 lines

  1. Newsgroups: comp.sources.misc
  2. From: mool@oce.nl (Bram Moolenaar)
  3. Subject: v41i071:  vim - Vi IMitation editor, v2.0, Part21/25
  4. Message-ID: <1993Dec21.172817.2085@sparky.sterling.com>
  5. X-Md4-Signature: 5da429366eda39f64256652cb8cc63bb
  6. Keywords: utility, editor, vi, vim
  7. Sender: kent@sparky.sterling.com (Kent Landfield)
  8. Organization: Sterling Software
  9. Date: Tue, 21 Dec 1993 17:28:17 GMT
  10. Approved: kent@sparky.sterling.com
  11.  
  12. Submitted-by: mool@oce.nl (Bram Moolenaar)
  13. Posting-number: Volume 41, Issue 71
  14. Archive-name: vim/part21
  15. Environment: UNIX, AMIGA, MS-DOS
  16. Supersedes: vim: Volume 37, Issue 1-24
  17.  
  18. #! /bin/sh
  19. # This is a shell archive.  Remove anything before this line, then unpack
  20. # it by saving it into a file and typing "sh file".  To overwrite existing
  21. # files, type "sh file -c".  You can also feed this as standard input via
  22. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  23. # will see the following message at the end:
  24. #        "End of archive 21 (of 25)."
  25. # Contents:  vim/doc/reference.do3
  26. # Wrapped by mool@oce-rd2 on Wed Dec 15 09:50:08 1993
  27. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  28. if test -f 'vim/doc/reference.do3' -a "${1}" != "-c" ; then 
  29.   echo shar: Will not clobber existing file \"'vim/doc/reference.do3'\"
  30. else
  31. echo shar: Extracting \"'vim/doc/reference.do3'\" \(44166 characters\)
  32. sed "s/^X//" >'vim/doc/reference.do3' <<'END_OF_FILE'
  33. X
  34. X- If the tag is in the current file, the command will always work.
  35. X- If the tag is in another file and the current file was not changed, the 
  36. X  other file will be made the current file and read into the buffer.
  37. X- If the tag is in another file, the current file was changed and a ! is 
  38. X  added to the command, the changes to the current file are lost, the other 
  39. X  file will be made the current file and read into the buffer.
  40. X- If the tag is in another file, the current file was changed and the 
  41. X  'autowrite' option is set, the current file will be written, the other 
  42. X  file will be made the current file and read into the buffer.
  43. X- If the tag is in another file, the current file was changed and the 
  44. X  'autowrite' option is not set, the command will fail. If you want to save 
  45. X  the changes, use the ":w" command and then use ":tag" without an argument. 
  46. X  This works because the tag is put on the stack anyway. If you want to lose 
  47. X  the changes you can use the ":tag!" command.
  48. X
  49. XThe ":tag" command works very well for C programs. If you see a call to a
  50. Xfunction and wonder what that function does, position the cursor inside of 
  51. Xthe function name and hit CTRL-]. This will bring you to the function 
  52. Xdefinition. An easy way back is with the CTRL-T command. Also read about the 
  53. Xtag stack below.
  54. X
  55. XA tags file can be created with the external command 'ctags'. It will 
  56. Xcontain a tag for each function. Some versions of 'ctags' will also make a 
  57. Xtag for each "#defined" macro.
  58. X
  59. XThe lines in the tags file should have this format:
  60. X
  61. X    {tag}{separator}{filename}{separator}{command}
  62. X
  63. X{tag}        the identifier
  64. X{separator}    one or more <TAB> or space characters
  65. X{filename}    the file that contains the definition of {tag}
  66. X{command}    the Ex command that positions the cursor on the tag (it can
  67. X        be any Ex command, but normally it is a search command like 
  68. X        "/^main").
  69. X
  70. XThe 'tags' option is a list of file names separated by spaces. Each of these 
  71. Xfiles is searched for the tag. This can be used to use a different file than 
  72. Xthe default file "tags". It can also be used to access a common tags file. 
  73. XFor example:
  74. X
  75. X:set tags=tags\ s:commontags
  76. X
  77. XThe tag will first be searched for in the file "tags" in the current 
  78. Xdirectory. If it is not found there the file "s:commontags" will be searched 
  79. Xfor the tag. The backslash is required for the space to be included in the 
  80. Xstring option.
  81. X
  82. X
  83. XThe tags that you use are remembered in the tag stack. You can print this 
  84. Xstack with the ":tags" command. The result looks like this:
  85. X
  86. X  # TO tag      FROM line in file
  87. X  1 main               1  harddisk2:text/vim/test
  88. X> 2 FuncA             58  -current-
  89. X  3 FuncC            357  harddisk2:text/vim/src/amiga.c
  90. X
  91. XThis list shows the tags that you jumped to and the cursor position before that 
  92. Xjump. The older tags are at the top, the newer at the bottom.
  93. X
  94. XThe <>> points to the active entry. This is the tag that will be used by the 
  95. Xnext ":tag" command. The CTRL-T and ":pop" command will use the position 
  96. Xabove the active entry.
  97. X
  98. XThe line number and file name are remembered to be able to get back to where 
  99. Xyou were before the tag command. As long as you stay within one file the 
  100. Xline number will be correct, also when deleting/inserting lines. When you go 
  101. Xto another file the line number may not always be correct (keeping them 
  102. Xcorrect all the time would take too much time). To avoid this use the 
  103. X":tags" command before abandoning a file, which will update the line numbers 
  104. Xin the current file.
  105. X
  106. XYou can jump to previously used tags with several commands. Some examples:
  107. X
  108. X    ":pop" or CTRL-T     to position before previous tag
  109. X    {count}CTRL_T        to position before {count} older tag
  110. X    ":tag"            to newer tag
  111. X    ":0tag"         to last used tag
  112. X
  113. XThe most obvious way to use this is while browsing through the call graph of 
  114. Xa program. Consider the following call graph:
  115. X
  116. X    main  --->  FuncA  --->  FuncC
  117. X          --->  FuncB
  118. X
  119. X(Explanation: main calls FuncA and FuncB; FuncA calls FuncC).
  120. XYou can get from main to FuncA by using CTRL-] on the call to FuncA. Then 
  121. Xyou can CTRL-] to get to FuncC. If you now want to go back to main you can 
  122. Xuse CTRL-T twice. Then you can CTRL-] to FuncB.
  123. X
  124. XIf you issue a ":ta {ident}" or CTRL-] command, this tag is inserted at the 
  125. Xbottom of the stack. If the stack was full (it can hold up to 20 entries),
  126. Xthe oldest entry is deleted and the older entries shift one position up
  127. X(their index number is decremented by one). If the last used entry was not
  128. Xat the bottom, the entries below the last used one are moved to the top.
  129. XThis means that an old branch in the call graph is not lost, but moved to
  130. Xanother place on the tag stack. The stack above would change to:
  131. X
  132. X  # TO tag      FROM line in file
  133. X  1 FuncA             58  harddisk2:text/vim/src/main.c
  134. X  2 FuncC            357  harddisk2:text/vim/src/amiga.c
  135. X  3 main               1  harddisk2:text/vim/test
  136. X  4 FuncB             59  harddisk2:text/vim/src/main.c
  137. X>
  138. X
  139. XIn the call graph example: You can use this to go back from FuncB to FuncC 
  140. Xby hitting CTRL-T twice. This may be a bit strange. Use the :tags command to 
  141. Xfind out what will happen with CTRL-T commands.
  142. X
  143. X
  144. X    9. Inserting text
  145. X
  146. XThe following commands can be used to insert new text into the buffer. They
  147. Xcan all be undone. The non-Ex commands can be repeated with the "." command.
  148. X
  149. Xa            Append text after the cursor [count] times.
  150. X
  151. XA            Append text at the end of the line [count] times.
  152. X
  153. Xi            Insert text before the cursor [count] times.
  154. X
  155. XI            Insert text before the first CHAR on the line
  156. X            [count] times.
  157. X
  158. Xo            Begin a new line below the cursor and insert text,
  159. X            repeat [count] times. {Vi: blank [count] screen
  160. X            lines}
  161. X
  162. XO            Begin a new line above the cursor and insert text,
  163. X            repeat [count] times. {Vi: blank [count] screen
  164. X            lines}
  165. X
  166. XThese commands are used to start inserting text. They can be undone and
  167. Xrepeated. You can end Insert mode with <ESC>. See the section "Insert and
  168. XReplace mode" for the other special characters in Insert mode. The effect of
  169. X[count] takes place after Insert mode is exited.
  170. X
  171. X:r[ead] {name}        Insert the file {name} below the cursor.
  172. X
  173. X:{range}r[ead] {name}    Insert the file {name} below the specified line.
  174. X
  175. X:r[ead] !{cmd}        Execute {cmd} and insert its standard output below
  176. X            the cursor.
  177. X
  178. XThese commands insert the contents of a file, or the output of a command, 
  179. Xinto the buffer. They can be undone. They cannot be repeated with the "." 
  180. Xcommand. They work on a line basis, insertion starts below the line in which 
  181. Xthe cursor is, or below the specified line. To insert text above the first 
  182. Xline use the command ":0r {name}".
  183. X
  184. XThe <LF> character is recognized as end-of-line marker. If the 'textmode'
  185. Xoption is set, a <CR> in front of an <LF> is ignored. The 'textmode' option
  186. Xis default on for MSDOS.
  187. X
  188. XIf the 'textauto' option is set Vim tries to recognize the type of
  189. Xend-of-line marker (see 5.2 how this is done). However, the 'textmode'
  190. Xoption will not be changed. Only while reading one file the text mode is
  191. Xused or not.
  192. X
  193. XOn non-MSDOS systems the message "[textmode]" is shown if a file is read in
  194. Xtext mode, to remind you that something unusual is done. On MSDOS the
  195. Xmessage "[notextmode]" is shown if a file is read without text mode.
  196. X
  197. X
  198. X    10. Deleting text
  199. X
  200. X["x]x            Delete [count] characters under and after the cursor
  201. X            [into register x] (not linewise).
  202. X
  203. X["x]X            Delete [count] characters before the cursor [into
  204. X            register x] (not linewise).
  205. X
  206. X["x]d{motion}        Delete text that is moved over [into register x]. 
  207. X            See below for exception.
  208. X
  209. X["x]dd            Delete [count] lines [into register x] (linewise).
  210. X
  211. X["x]D            Delete the characters under the cursor until the end
  212. X            of the line and [count]-1 more lines [into register 
  213. X            x]; synonym for d$ (not linewise).
  214. X
  215. X{visual}["x]x    or
  216. X{visual}["x]d        Delete the highlighted text [into register x] (see
  217. X            the chapter on Visual mode). {not in Vi}
  218. X
  219. X{visual}["x]X    or
  220. X{visual}["x]D        Delete the highlighted lines [into register x] (see
  221. X            the chapter on Visual mode). {not in Vi}
  222. X
  223. X:[range]d[elete] [x]    Delete [range] lines (default: current line) [into
  224. X            register x].
  225. X
  226. X:[range]d[elete] [x] {count}
  227. X            Delete {count} lines, starting with [range]
  228. X            (default: current line, see 4.4.3) [into register
  229. X            x].
  230. X
  231. XThese commands delete text. They can be repeated with the "." command
  232. X(except ":d") and undone. Use Visual mode to delete blocks of text. See
  233. X"copying" for an explanation of registers.
  234. X
  235. XAn exception for the d{motion} command: If the motion is not linewise, the 
  236. Xstart and end of the motion are not in the same line and before the start 
  237. Xand after the end are only blanks, the delete becomes linewise. This means 
  238. Xthat the blank line that would remain is also deleted.
  239. X
  240. X
  241. XJ            Join [count] lines, with a minimum of two lines.
  242. X
  243. X{visual}J        Join the highlighted lines, with a minimum of two
  244. X            lines. {not in Vi}
  245. X
  246. X:[range]j[oin][!]    Join [range] lines. Same as "J", except when [!] is
  247. X            given, then no spaces will be inserted or deleted.
  248. X
  249. X:[range]j[oin][!] {count}
  250. X            Join {count} lines, starting with [range] (default:
  251. X            current line, see 4.4.3). Same as "J", except when
  252. X            [!] is given, then no spaces will be inserted or 
  253. X            deleted.
  254. X
  255. XThese commands delete the newline between lines. This has the effect of 
  256. Xjoining them into one line. They can be repeated (except ":j") and undone. 
  257. X
  258. XOne space is inserted in place of the <LF>, unless the line ended with a 
  259. Xspace, <TAB> or the next line started with a <)>. If the next line has 
  260. Xleading white space it is deleted first. If the 'joinspaces' option is set, 
  261. Xtwo spaces are inserted after a period.
  262. X
  263. X
  264. X    11. Changing text
  265. X
  266. XThe following commands can be used to change text, that is delete some text 
  267. Xand insert something else, with one command. They can all be undone. The 
  268. Xnon-Ex commands can be repeated with the "." command.
  269. X
  270. X
  271. X11.1 Delete and insert
  272. X
  273. XR            Enter Replace mode: Each character you type replaces
  274. X            an existing character, starting with the character
  275. X            under the cursor. Repeat the entered text [count]-1
  276. X            times.
  277. X
  278. X["x]c{motion}        Delete {motion} text [into register x] and start
  279. X            insert.
  280. X
  281. X["x]cc            Delete [count] lines [into register x] and start
  282. X            insert (linewise).
  283. X
  284. X["x]C            Delete from the cursor position to the end of the
  285. X            line and [count]-1 more lines [into register x], and 
  286. X            start insert. Synonym for c$ (not linewise).
  287. X
  288. X["x]s            Delete [count] characters [into register x] and start
  289. X            insert (s stands for Substitute). Synonym for "cl"
  290. X            (not linewise).
  291. X
  292. X["x]S            Delete [count] lines [into register x] and start 
  293. X            insert. Synonym for "^cc" with 'autoindent' option 
  294. X            or "0cc" with 'noautoindent' option (not linewise).
  295. X
  296. X{visual}["x]c    or
  297. X{visual}["x]r    or
  298. X{visual}["x]s        Delete the highlighted text [into register x] and
  299. X            start insert (see the chapter on Visual mode). {not
  300. X            in Vi}
  301. X
  302. X{visual}["x]C    or
  303. X{visual}["x]R    or
  304. X{visual}["x]S        Delete the highlighted lines [into register x] and
  305. X            start insert (see the chapter on Visual mode). {not
  306. X            in Vi}
  307. X
  308. XYou can end Insert and Replace mode with <ESC>. See the section "Insert and
  309. XReplace mode" for the other special characters in these modes. The effect of
  310. X[count] takes place after Insert or Replace mode is exited. {Vi: does not
  311. Xdirectly delete the text, but puts a <$> at the last deleted character}
  312. XSee "Copying and moving text" for an explanation of registers.
  313. X
  314. XReplace mode is just like Insert mode, except that for every character you 
  315. Xenter, one character is deleted. If the end of a line is reached, further 
  316. Xcharacters are appended (just like Insert mode). In Replace mode the 
  317. Xbackspace key restores the original text (if there was any) (see section
  318. X"Insert and Replace mode").
  319. X
  320. XSpecial case: "cw" and "cW" are treated like "ce" and "cE" if the cursor is 
  321. Xon a non-blank. This is because "cw" is interpreted as change-word, and a 
  322. Xword does not include the following white space. {Vi: "cw" when on a blank 
  323. Xfollowed by other blanks changes only the first blank; this is probably a 
  324. Xbug, because "dw" deletes all the blanks}
  325. X
  326. X
  327. X11.2 Simple changes
  328. X
  329. Xr<char>            Replace the character under the cursor by <char>. If
  330. X            <char> is a <CR> or <LF> the character will be
  331. X            replaced by a line break. If a [count] is given that
  332. X            many characters will be replaced by [count] <char>s
  333. X            or line breaks {Vi: "5r<CR>" replaces five
  334. X            characters with a single line break}
  335. X
  336. X~            'notildeop' option: switch case of the character
  337. X            under the cursor and move the cursor to the right.
  338. X            If a [count] is given do that many characters {Vi:
  339. X            no count}
  340. X
  341. X~{motion}        'tildeop' option: switch case of {motion} text. {Vi: 
  342. X            tilde cannot be used as an operator}
  343. X
  344. X{visual}~        switch case of highlighted text (see the chapter on 
  345. X            Visual mode). {not in Vi}
  346. X
  347. X{visual}U        Make highlighted text uppercase (see the chapter on 
  348. X            Visual mode). {not in Vi}
  349. X
  350. X{visual}u        Make highlighted text lowercase (see the chapter on 
  351. X            Visual mode). {not in Vi}
  352. X
  353. XCTRL-A            Add [count] to the number at or after the cursor.
  354. X            {not in Vi}
  355. X
  356. XCTRL-S            Subtract [count] from the number at or after the 
  357. X            cursor. If your terminal has problems with CTRL-S
  358. X            read unix.doc. {not in Vi}
  359. X
  360. XThe CTRL-A and CTRL-S commands work for (signed) decimal numbers and 
  361. Xunsigned octal and hexadecimal numbers. Numbers starting with '0x' or '0X' 
  362. Xare assumed to be hexadecimal. To decide whether the hexadecimal number 
  363. Xshould be printed uppercase or not, the case of the rightmost letter in the 
  364. Xnumber is considered. If there is no letter in the current number, the 
  365. Xpreviously detected case is used. Numbers starting with a <0> are considered 
  366. Xto be octal. Other numbers are decimal and may be preceded with a minus 
  367. Xsign. If the cursor is on a number, that one will be used. Otherwise the 
  368. Xnumber right of the cursor will be used.
  369. X
  370. XThe CTRL-A command is very useful in a macro. Example: How to make a 
  371. Xnumbered list.
  372. X
  373. X1. Create the first entry. The entry should start with a number.
  374. X2. qa        - start recording into buffer <a>
  375. X3. Y         - yank the entry
  376. X4. p         - put a copy of the entry below the first one
  377. X5. CTRL-A    - increment the number
  378. X6. q         - stop recording
  379. X7. <count>@a - repeat the yank, put and increment <count> times
  380. X
  381. X
  382. X<{motion}        Shift the {motion} lines one shiftwidth leftwards.
  383. X
  384. X<<            Shift [count] lines one shiftwidth leftwards.
  385. X
  386. X{visual}<        Shift the highlighted lines one shiftwidth leftwards
  387. X            (see the chapter on Visual mode). {not in Vi}
  388. X
  389. X>{motion}        Shift {motion} lines one shiftwidth rightwards.
  390. X
  391. X>>            Shift [count] lines one shiftwidth rightwards.
  392. X
  393. X{visual}>        Shift the highlighted lines one shiftwidth
  394. X            rightwards (see the chapter on Visual mode). {not in
  395. X            Vi}
  396. X
  397. X:[range]<        Shift [range] lines left.
  398. X
  399. X:[range]< {count}    Shift {count} lines left, starting with [range]
  400. X            (default current line, see 4.4.3).
  401. X
  402. X:[range]le[ft] [indent]    left align lines in [range]. Sets the indent in the
  403. X            lines to [indent] (default 0). {not in Vi}
  404. X
  405. X:[range]>        Shift {count} [range] lines right.
  406. X
  407. X:[range]> {count}    Shift {count} lines right, starting with [range]
  408. X            (default current line, see 4.4.3).
  409. X
  410. XThe ">" and "<" commands are handy for changing the indent within programs. 
  411. XThe size of the white space which is inserted or deleted can be set with the 
  412. X'shiftwidth' option. Normally the 'shiftwidth' option is set to 8, but you 
  413. Xcan set it to e.g. 3 to make smaller indents. The shift leftwards stops when 
  414. Xthere is no indent. The shift right does not do anything with empty lines. 
  415. X
  416. XIf the 'shiftround' option is set, the indent is rounded to a multiple of 
  417. X'shiftwidth'.
  418. X
  419. XWhen the 'expandtab' option if off (this is the default) <TAB>s are used as 
  420. Xmuch as possible to make the indent. You can use ">><<" to replace an indent 
  421. Xmade out of spaces with the same indent made out of <TAB>s (and a few 
  422. Xspaces if neccessary). If the 'expandtab' option is on, only spaces are 
  423. Xused. Then you can use ">><<" to replace <TAB>s in the indent by spaces.
  424. X
  425. XQ{motion}        Format the lines that were moved over. The length of 
  426. X            each line will be restricted to the width set with 
  427. X            the 'textwidth' option. If the 'textwidth' option is
  428. X            0, all lines will be joined together. If the
  429. X            'autoindent' option is set, the indent of the first
  430. X            line is used for the following lines. The
  431. X            'formatprg' option can be set to the name of an
  432. X            external program, which will be used instead of the
  433. X            internal function. The 'textwidth' option will then
  434. X            not be used. {not in Vi}
  435. X
  436. X:[range]ce[nter] [width]
  437. X            Center lines in [range] between [width] columns
  438. X            (default 'textwidth' or 80 when 'textwidth' is 0).
  439. X            {not in Vi}
  440. X
  441. X:[range]ri[ght] [width]
  442. X            right align lines in [range] at [width] columns
  443. X            (default 'textwidth' or 80 when 'textwidth' is 0).
  444. X            {not in Vi}
  445. X
  446. X
  447. X11.3 Complex changes
  448. X
  449. X!{motion}{filter}    Filter {motion} text through the external program
  450. X            {filter}.
  451. X
  452. X!!{filter}        Filter [count] lines through the external program
  453. X            {filter}.
  454. X
  455. X{visual}!{filter}    Filter the highlighted lines through the external
  456. X            program {filter} (see the chapter on Visual mode).
  457. X            {not in Vi}
  458. X
  459. X:{range}![!]{filter} [!][arg]
  460. X            Filter {range} lines through the external program
  461. X            {filter}. The optional bangs are replaced with the
  462. X            latest given command. The optional [arg] is appended.
  463. X
  464. X={motion}        Filter {motion} lines through the external program 
  465. X            given with the 'equalprg' option (default: 
  466. X            "indent"). {Vi: when 'lisp' option is set, autoindent 
  467. X            {motion} lines}
  468. X
  469. X==            Filter [count] lines through the external program
  470. X            given with the 'equalprg' option (default: indent).
  471. X            {not in Vi}
  472. X
  473. X{visual}=        Filter the highlighted lines through the external
  474. X            program given with the 'equalprg' option (default:
  475. X            indent) (see the chapter on Visual mode). {not in
  476. X            Vi}
  477. X
  478. XA filter is a program that accepts text at standard input, changes it in some
  479. Xway, and sends it to standard output. The commands above can be used to send
  480. Xsome text through a filter. An example of a filter is "sort", which sorts 
  481. Xlines alphabetically. The "indent" program is used to pretty indent C 
  482. Xprograms (you need a version of indent that works like a filter, not all 
  483. Xversions do that). The shell, given with the 'shell' option, is used to 
  484. Xexecute the command (See also the 'shelltype' option).
  485. XThe filter commands can be redone with ".".
  486. X
  487. X:[range]s[ubstitute]/{pattern}/{string}/[g][c] [count]
  488. X            For each line in [range] replace the first occurrence
  489. X            of {pattern} by {string}. With option [g] all 
  490. X            occurrences in the line are replaced. With option 
  491. X            [c] each replace has to be confirmed (<y> to 
  492. X            replace, <q> to quit replacing, <n> to skip). With
  493. X            [count] that many lines are are searched, starting
  494. X            with the last line number in [range] (default
  495. X            current line, see 4.4.3).
  496. X
  497. X:[range]s[ubstitute] [g][c] [count]
  498. X            Repeat last :substitute with new options and possibly
  499. X            on other lines.
  500. X
  501. X:[range]&[/{pattern}/{string}/][g][c] [count]
  502. X            Same as for :substitute.
  503. X
  504. X&            Synonym for ":s".
  505. X
  506. XIf the {pattern} for the substitute command is empty, the previously given
  507. Xpattern is used (from any search, including "/" and ":g").
  508. X
  509. XFor the definition of a pattern see 6.5, "Pattern searches".
  510. X
  511. XSome characters in {string} have a special meaning:
  512. X
  513. Xmagic    nomagic      action
  514. X  &      \&      replaced by the whole matched pattern
  515. X \&       &      replaced by &
  516. X      \0      replaced by the whole matched pattern
  517. X      \1      replaced by the matched pattern in the first pair of ()
  518. X      \2      replaced by the matched pattern in the second pair of ()
  519. X      ..      ..
  520. X      \9      replaced by the matched pattern in the ninth pair of ()
  521. X  ~      \~      replaced by the {string} of the previous substitute
  522. X \~       ~      replaced by ~
  523. X      \u      next character made uppercase
  524. X      \U      following characters made uppercase
  525. X      \l      next character made uppercase
  526. X      \L      following characters made uppercase
  527. X      \e      end of /u, /U, /l and /L
  528. X      \E      end of /u, /U, /l and /L
  529. X      <CR>      split line in two at this point
  530. X  CTRL-V <CR>      insert a carriage-return (CTRL-M)
  531. X
  532. XExamples:
  533. X:s/a\|b/xxx\0xxx/g          modifies "a b"      in "xxxaxxx xxxbxxx"
  534. X:s/\([abc]\)\([efg]\)/\2\1/g  modifies "af fa bg" in "fa fa gb"
  535. X:s/abcde/abc^Mde/          modifies "abcde"    in "abc", "de" (two lines)
  536. X:s/$/^V^M/              modifies "abcde"      in "abcde^M"
  537. X
  538. XNote: To insert a ^M you have to type CTRL-V <CR>. To insert a ^V you have
  539. Xto type CTRL-V CTRL-V. So to insert the ^V^M in the last example you have to
  540. Xtype CTRL-V CTRL-V CTRL-V <CR>.
  541. X
  542. XBecause CTRL-V <CR> inserts a <CR>, it is impossible to insert a CTRL-V just
  543. Xin front of a line break. You will have to split it up in two parts:
  544. X    :s/foo/^Vxxxx/
  545. X    :s/xxxx/^M/
  546. X
  547. XWhen using parentheses in combination with <|>, like in \([ab]\)\|\([cd]\), 
  548. Xeither the first or second pattern in parentheses did not match, so either 
  549. X\1 or \2 is empty. Example:
  550. X:s/\([ab]\)\|\([cd]\)/\1x/g   modifies "a b c d"  in "ax bx x x"
  551. X
  552. X
  553. X    12. Copying and moving text
  554. X
  555. X"<a-zA-Z0-9.%">        Use register <a-zA-Z0-9.%"> for next delete, yank or
  556. X            put (use uppercase character to append with delete
  557. X            and yank) (<.> only works with put).
  558. X
  559. X:di[splay]        Display the contents of numbered and named registers.
  560. X            {Vi: no such command}
  561. X
  562. X["x]y{motion}        Yank {motion} text [into register x].
  563. X
  564. X["x]yy            Yank [count] lines [into register x] (linewise).
  565. X
  566. X["x]Y            With 'noyankendofline' option: yank [count] lines 
  567. X            [into register x] (synonym for yy, linewise); with 
  568. X            'yankendofline' option: yank until end of line 
  569. X            (synonym for y$, not linewise).
  570. X
  571. X{visual}["x]y        Yank the highlighed text [into register x] (see the 
  572. X            chapter on Visual mode). {not in Vi}
  573. X
  574. X{visual}["x]Y        Yank the highlighted lines [into register x] (see the 
  575. X            chapter on Visual mode). {not in Vi}
  576. X
  577. X:[range]y[ank] [x]    Yank [range] lines [into register x].
  578. X
  579. X:[range]y[ank] [x] {count}
  580. X            Yank {count} lines, starting with last line number 
  581. X            in [range] (default: current line, see 4.4.3), [into 
  582. X            register x].
  583. X
  584. X["x]p            Put the text [from register x] after the cursor
  585. X[count]
  586. X            times. {Vi: no count}
  587. X
  588. X["x]P            Put the text [from register x] before the cursor
  589. X            [count] times. {Vi: no count}
  590. X
  591. X:[line]pu[t] [x]    Put the text [from register x] after [line] (default
  592. X            current line).
  593. X
  594. X:[line]pu[t]! [x]    Put the text [from register x] before [line] (default
  595. X            current line).
  596. X
  597. XThese commands can be used to copy text from one place to another. This is 
  598. Xdone by first getting the text into a register with a yank, delete or change 
  599. Xcommand. The register can then be inserted with a put command. All registers 
  600. Xare kept when changing files. Thus you can also use this to move text from 
  601. Xone file to another (the CTRL-^ command is a quick way to toggle between two 
  602. Xfiles).
  603. X
  604. XThe put commands can be repeated with "." (except for :put) and undone. If the
  605. Xcommand that was used to get the text into the register was linewise, the 
  606. Xtext will be inserted below ("p") or above ("P") the line where the cursor
  607. Xis. Otherwise the text will be inserted after ("p") or before ("P") the
  608. Xcursor. With the ":put" command the text will always be inserted in the next
  609. Xline. You can exchange two characters with the command sequence "xp". You
  610. Xcan exchange two lines with the command sequence "ddp". You can exchange
  611. Xtwo words with the command sequence "deep" (start with the cursor in the
  612. Xblank space before the first word). The "']" or "`]" command can be used
  613. Xafter the put command to move the cursor to the end of the inserted text,
  614. X"'[" or "`[" to move the cursor to the start.
  615. X
  616. XIf the command that was used to get the text into the register used 
  617. Xblockwise Visual mode, the block of text will be inserted before ("P") or
  618. Xafter ("p") the cursor column, in the current and next lines. Vim will make
  619. Xthe whole block of text start in the same column. Thus the inserted text
  620. Xlooks the same as when it was yanked or deleted. Some <TAB> characters may
  621. Xbe replaced by spaces to make this happen. However, if the width of the
  622. Xblock is not a multiple of a <TAB> width and the text after the inserted
  623. Xblock contains <TAB>s, that text may be misaligned.
  624. X
  625. XThere are four types of registers: The unnamed regster, 10 numbered
  626. Xregisters, 26 named registers and two read-only registers.
  627. X    The unnamed register is the register where all text deleted with     
  628. Xthe "d", "c", "s", "x" commands or copied with the yank "y" command is
  629. Xplaced, regardless of whether or not a specific register was used (e.g.
  630. X"xdd). The contents of this register are used by any put command (p or P)
  631. Xwhich does not specify a register. Additionally it can be accessed by the
  632. Xname <">. This means you have to type two double quotes. {Vi: register
  633. Xcontents lost when changing files, no <">}
  634. X    The numbered registers are filled with yank and delete commands. 
  635. XNumbered register <0> is filled with the last yank command, unless another 
  636. Xregister was specified with ["x]. Numbered register <1> is filled with the 
  637. Xtext that was deleted by each delete or change command, unless another 
  638. Xregister was specified or the text is less than one line (text deleted with
  639. X"x" or "dw" will not be put in a numbered register). The contents of
  640. Xregister <1> are put in <2>, <2> in <3>, and so forth. The contents of
  641. Xregister <9> are lost. {Vi: numbered register contents are lost when
  642. Xchanging files; register 0 does not exist}
  643. X    The named registers are only filled when you say so. They are named 
  644. X<a> to <z> normally. If you use an uppercase letter, the same registers as 
  645. Xwith the lower case letter is used, but the text is appended to the previous 
  646. Xregister contents. With a lower case letter the previous contents are lost.
  647. X    The read-only registers are <%> and <.>. They can only be used with the
  648. Xcommands "p", "P" and ":put". <.> contains the last inserted text (the same
  649. Xas what is inserted with the insert mode commands CTRL-A and CTRL-@). <%>
  650. Xcontains the name of the current file.
  651. X
  652. XIf you use a put command without specifying a register, the register that 
  653. Xwas last written to is used (this is also the contents of the unnamed
  654. Xregister). If you are confused, use the ":dis" command to find out what will
  655. Xbe put (all named and numbered registers are displayed; the unnamed register
  656. Xis labelled <">).
  657. X
  658. XThe next three commands always work on whole lines.
  659. X
  660. X:[range]co[py] {address}
  661. X            Copy the lines given by [range] to below the line
  662. X            given by {address}.
  663. X
  664. X:t            Synonym for copy.
  665. X
  666. X:[range]m[ove] {address}
  667. X            Move the lines given by [range] to below the line
  668. X            given by {address}.
  669. X
  670. X
  671. X    13. Visual mode
  672. X
  673. XVisual mode is a flexible and easy way to select a piece of text for an 
  674. Xoperator. It is the only way to select a block of text.
  675. X
  676. Xv            start/stop Visual mode per character. {not in Vi}
  677. X
  678. XV            start/stop Visual mode linewise. {not in Vi}
  679. X
  680. XCTRL-V            start/stop Visual mode blockwise. {not in Vi}
  681. X
  682. Xo            go to Other end of highlighted text: The current
  683. X            cursor position becomes the start of the highlighted
  684. X            text and the cursor is moved to the Other end of the
  685. X            highlighted text. {not in Vi} 
  686. X
  687. XTo apply an operator on a piece of text:
  688. X    1. mark the start of the text with "v", "V" or CTRL-V
  689. X        The character under the cursor will be used as the start.
  690. X    2. move to the end of the text
  691. X        The text from the start of the Visual mode up to and
  692. X        including the character under the cursor is highlighted.
  693. X    3. hit an operator
  694. X        The highlighted characters will be operated upon.
  695. X
  696. XThe highlighted text includes the character under the cursor. On terminals
  697. Xwhere it is possible to make the cursor invisible the cursor position is
  698. Xalso highlighted. On terminals where this is not possible the cursor is
  699. Xdisplayed normally.
  700. X
  701. XWith "v" the text before the start position and after the end position will 
  702. Xnot be highlighted. However, All uppercase and non-alpha operators, except 
  703. X"~", will work on whole lines anyway. See the list of operators below.
  704. X
  705. XWith CTRL-V (blockwise Visual mode) the highlighted text will be a rectangle
  706. Xbetween start position and the cursor. However, some operators work on whole
  707. Xlines anyway (see the list below). The change and substitute operators will
  708. Xdelete the highlighted text and then start insertion at the top left
  709. Xposition. 
  710. X
  711. XWhen the "$" command is used with blockwise Visual mode, the right end of the 
  712. Xhighlighted text will be determined by the longest highlighted line. This
  713. Xstops when a motion command is used that does not move straight up or down.
  714. X
  715. XIf "v", "V", CTRL-V or ESC is typed while in Visual mode, the highlighting
  716. Xstops and no text is affected. If you hit CTRL-Z the highlighting stops and
  717. Xthe editor is suspended or a new shell is started.
  718. X
  719. XFor moving the end of the block many commands can be used, but you cannot 
  720. Xuse Ex commands, commands that make changes or abandon the file. Commands 
  721. X(starting with) ".pPiIaAO&", CTRL_^, "ZZ", CTRL-], CTRL-T, CTRL-R, CTRL-I 
  722. Xand CTRL-O cause a beep and Visual mode continues. 
  723. X
  724. XIf the "v", "V" or CTRL-V is preceded with a count, the previously
  725. Xhighlighted area is used for a start. You can then move the end of the
  726. Xhighlighted area and give an operator. The type of the old area is used
  727. X(character, line or blockwise).
  728. X- Linewise Visual mode: The number of lines is multiplied with the count.
  729. X- Blockwise Visual mode: The number of lines and columns is multiplied with
  730. X  the count.
  731. X- Normal Visual mode within one line: The number of characters is multipled
  732. X  with the count.
  733. X- Normal Visual mode with several lines: The number of lines is multipled
  734. X  with the count, in the last line the same number of characters is used as
  735. X  in the last line in the previously highlighted area.
  736. XThe start of the text is the Cursor position. If the "$" command was used as 
  737. Xone of the last commands to extend the highlighted text, the area will be
  738. Xextended to the rightmost column of the longest line.
  739. X
  740. XThe operators that can be used are:
  741. X    ~    switch case
  742. X    d    delete
  743. X    c    change
  744. X    y    yank
  745. X    >    shift right (1)(*)
  746. X    <    shift left (1)(*)
  747. X    !    filter through external command (1)
  748. X    =    filter through 'equalprg' option command (1)
  749. X    Q    format lines to 'textwidth' length (1)
  750. X
  751. XAdditionally the following commands can be used:
  752. X    :    start ex command for highlighted lines (1)
  753. X    r    change
  754. X    s    change
  755. X    C    change (2)
  756. X    R    change (2)
  757. X    S    change (2)
  758. X    x    delete
  759. X    D    delete (2)
  760. X    X    delete (2)
  761. X    Y    yank (2)
  762. X    J    join (1)
  763. X    U    make uppercase
  764. X    u    make lowercase
  765. X
  766. X(1): always whole lines
  767. X(2): whole lines when not using CTRL-V
  768. X(*): in a future a blockwise shift will move the block only, not whole
  769. X     lines.
  770. X
  771. XIf you want to give a register name using the """ command, do this just before 
  772. Xtyping the operator character: "v{move around}"xd".
  773. X
  774. XWhen repeating a Visual mode operator, the operator will be applied to the
  775. Xsame amount of text as the last time:
  776. X- Linewise Visual mode: The same number of lines.
  777. X- Blockwise Visual mode: The same number of lines and columns.
  778. X- Normal Visual mode within one line: The same number of characters.
  779. X- Normal Visual mode with several lines: The same number of lines, in the
  780. X  last line the same number of characters as in the last line the last time.
  781. XThe start of the text is the Cursor position. If the "$" command was used as 
  782. Xone of the last commands to extend the highlighted text, the repeating will
  783. Xbe applied up to the rightmost column of the longest line.
  784. X
  785. X
  786. X    14. Various commands
  787. X
  788. XCTRL-L            Clear and redraw the screen.
  789. X
  790. XCTRL-Z            On Unix systems: Suspend Vim. On other systems: 
  791. X            start a new shell (like ":sh").
  792. X
  793. X<HELP>        or
  794. X:h[elp]            Show the help file page by page. The help file name 
  795. X            can be set with the 'helpfile' option. Type an index
  796. X            character to go directly to a page. Type <SPACE> or
  797. X            CTRL-F (with MSDOS: page-down) to go one page
  798. X            forward. Type <b> or CTRL-B (with MSDOS: page-up) to
  799. X            go one page back. Type <a> to go back to the index.
  800. X            Type <CR> to get out of the help screen. {Vi: no
  801. X            help}
  802. X
  803. X<DEL>            When entering a number: remove the last digit.
  804. X
  805. X:[range]p[rint]        Print [range] lines (default current line).
  806. X
  807. X:[range]p[rint] {count}
  808. X            Print {count} lines, starting with [range] (default
  809. X            current line, see 4.4.3).
  810. X
  811. X:[range]l[ist] [count]
  812. X            Same as :print, but display unprintable characters
  813. X            with <^>.
  814. X
  815. X:[range]nu[mber] [count]
  816. X            Same as :print, but precede each line with its line
  817. X            number.
  818. X
  819. X:=            Print the line number.
  820. X
  821. X:sh[ell]        Escape to a shell (name from 'shell' option).
  822. X
  823. X:![!]{cmd} [!][arg]    Execute {cmd} with the shell. The optional bangs are
  824. X            replaced with the previously given command. The 
  825. X            optional [arg] is appended. See also the 'shell' and 
  826. X            'shelltype' option.
  827. X
  828. X:ve[rsion]        Print the version number of the editor.
  829. X
  830. XK            Run a program to lookup the identifier under the 
  831. X            cursor. The name of the program is given with the 
  832. X            'keywordprg' (kp) option. The identifier is formed 
  833. X            of letters, numbers and the underscore. The 
  834. X            identifier under or right of the cursor is used. The 
  835. X            same can be done with the command
  836. X                ":!{program} {identifier}". 
  837. X            {not in Vi}
  838. X
  839. X
  840. X    15. Repeating commands
  841. X
  842. X15.1 Single repeats
  843. X
  844. X.            Repeat last change with count replaced by [count].
  845. X
  846. XSimple changes can be repeated with the "." command. Without a count, the 
  847. Xcount of the last change is used. If you enter a count, it will replace the 
  848. Xlast one. If the last change included a specification of a numbered 
  849. Xregister, the register number will be incremented. See the section on undo 
  850. Xand redo for an example how to use this.
  851. X
  852. X
  853. X15.2 Multiple repeats
  854. X
  855. X:[range]g[lobal]/{pattern}/[cmd]
  856. X            Execute the Ex command [cmd] (default ":p") on the
  857. X            lines within [range] where {pattern} matches.
  858. X
  859. X:[range]g[lobal]!/{pattern}/[cmd]
  860. X            Execute the Ex command [cmd] (default ":p") on the
  861. X            lines within [range] where {pattern} does NOT match.
  862. X
  863. X:[range]v[global]/{pattern}/[cmd]
  864. X            Same as :g!.
  865. X
  866. XThe global commands work by first scanning through the [range] lines and
  867. Xmarking each line where a match occurs. In a second scan the [cmd] is 
  868. Xexecuted for each marked line with its line number prepended. If a line is 
  869. Xchanged or deleted its mark disappears. The default for [range] is the whole 
  870. Xbuffer (1,$). Use "CTRL-C" to interrupt the command.
  871. X
  872. XTo repeat a non-Ex command, you will have to put the command in a file and 
  873. Xuse "source!". For example:
  874. X    :g/pat/so! scriptfile
  875. XMake sure that the scriptfile ends with a whole command, otherwise Vim will 
  876. Xwait for you to type the rest of the command for each match. The screen will 
  877. Xnot have been updated, so you don't know what you are doing.
  878. X    
  879. XThe undo/redo command will undo/redo the whole global command at once.
  880. X
  881. X
  882. X15.3 Complex repeats
  883. X
  884. Xq<0-9a-zA-Z">        Record typed characters into register <0-9a-zA-Z">
  885. X            (uppercase to append). The 'q' that stops recording
  886. X            is also stored in the register. The 'q' command is
  887. X            disabled while executing a register. (Implementation
  888. X            note: This was done because the 'q' command can be
  889. X            the result of mapping). {Vi: no recording}
  890. X
  891. Xq            Stops recording. {Vi: no recording}
  892. X
  893. X@<0-9a-z">        Execute the contents of register <0-9a-z"> [count]
  894. X            times. {Vi: only named registers}
  895. X
  896. X@@            Repeat the previous @<0-9a-z"> [count] times.
  897. X
  898. X:@<0-9a-z">        Execute the contents of register <0-9a-z"> as
  899. X            an Ex command. {Vi: only in some versions}
  900. X
  901. X:@@            Repeat the previous :@<0-9a-z">. {Vi: only in some 
  902. X            versions}
  903. X
  904. X:so[urce] {file}    Read Ex commands from {file}.
  905. X
  906. X:so[urce]! {file}    Read Vim commands from {file}. {not in Vi}
  907. X
  908. XAll commands and command sequences can be repeated by putting them in a named
  909. Xregister and then executing it. There are two ways to get the commands in the
  910. Xregister:
  911. X- Use the record command "q". You type the commands once, and while they are
  912. X  being executed they are stored in a register. Easy, because you can see 
  913. X  what you are doing. If you make a mistake, 'put' the register into the 
  914. X  file, edit the command sequence, and then delete it into the register 
  915. X  again. You can continue recording by appending to the register (use an 
  916. X  uppercase letter).
  917. X- Delete or yank the command sequence into the register.
  918. X
  919. XOften used command sequences can be put under a function key with the ':map'
  920. Xcommand.
  921. X
  922. XAn alternative is to put the commands in a file, and execute them with the
  923. X':source!' command. Useful for long command sequences. Can be combined with 
  924. Xthe ':map' command to put complicated commands under a function key.
  925. X
  926. XThe ':source' command reads Ex commands from a file line by line. You will 
  927. Xhave to type any needed keyboard input. The ':source!' command reads from a 
  928. Xscript file character by character, interpreting each character as if you 
  929. Xtyped it.
  930. X
  931. XExample: When you give the ":!ls" command you are asked to "hit return to
  932. Xcontinue". If you ':source' a file with the line "!ls" in it, you will have 
  933. Xto type the return yourself. But if you ':source!' a file with the line 
  934. X":!ls" in it, the next characters from that file are read until a <CR> is 
  935. Xfound. You will not have to type <CR> yourself, unless ":!ls" was the last 
  936. Xline in the file.
  937. X
  938. XIt is possible to put ':source[!]' commands in the script file, so you can 
  939. Xmake a top-down hierachy of script files. The ':source' command can be 
  940. Xnested as deep as the number of files that can be opened at one time (about 
  941. X15). The ':source!' command can be nested up to 15 levels deep.
  942. X
  943. XIn script files terminal-dependent key codes are represented by 
  944. Xterminal-independent single character codes. In the MSDOS version the values
  945. Xare 48 (0x30) higher. Any of these codes can be entered with CTRL-V followed
  946. Xby the three digit decimal code.
  947. X
  948. X    code    hex    meaning
  949. X
  950. X    128    0x80    up-arrow
  951. X    129    0x81    down-arrow
  952. X    130    0x82    left-arrow
  953. X    131    0x83    right-arrow
  954. X    132    0x84    shift up-arrow
  955. X    133    0x85    shift down-arrow
  956. X    134    0x86    shift left-arrow
  957. X    135    0x87    shift right-arrow
  958. X
  959. X    136    0x88    function key 1
  960. X    137    0x89    function key 2
  961. X    138    0x8a    function key 3
  962. X    139    0x8b    function key 4
  963. X    140    0x8c    function key 5
  964. X    141    0x8d    function key 6
  965. X    142    0x8e    function key 7
  966. X    143    0x8f    function key 8
  967. X    144    0x90    function key 9
  968. X    145    0x91    function key 10
  969. X
  970. X    146    0x92    shifted function key 1
  971. X    147    0x93    shifted function key 2
  972. X    148    0x94    shifted function key 3
  973. X    149    0x95    shifted function key 4
  974. X    150    0x96    shifted function key 5
  975. X    151    0x97    shifted function key 6
  976. X    152    0x98    shifted function key 7
  977. X    153    0x99    shifted function key 8
  978. X    154    0x9a    shifted function key 9
  979. X    155    0x9b    shifted function key 10
  980. X
  981. X    156    0x9c    help key
  982. X    157    0x9d    undo key
  983. X    158    0x9e    special-function key follows (MSDOS)
  984. X    159    0x9f    CTRL-@
  985. X
  986. X
  987. X    16. Undo and redo
  988. X
  989. X<UNDO>        or
  990. Xu            Undo [count] changes. {Vi: only one level}
  991. X
  992. X:u[ndo]            Undo one change. {Vi: only one level}
  993. X
  994. XCTRL-R            Redo [count] changes which were undone. {Vi: redraw 
  995. X            screen}
  996. X
  997. X:red[o]            Redo one change which was unodone. {Vi: no redo}
  998. X
  999. XU            Undo all latest changes on one line. {Vi: while not
  1000. X            moved off of it}
  1001. X
  1002. XThe last changes are remembered. You can go back in time with the "u" 
  1003. Xcommand. You can then go forward again with the 'CTRL-R' command. If you 
  1004. Xmake a new change after the "u" command, the 'CTRL-R' will not be possible 
  1005. Xanymore. The number of changes that are remembered is set with the 
  1006. X'undolevels' option. If it is zero, the old fashioned Vi undo is present: 
  1007. Xone level of undo and undo undoes itself. If it is negative no undo is
  1008. Xpossible. Use this if you are running out of memory.
  1009. X
  1010. XThe "U" command is treated by undo/redo just like any other command. Thus a 
  1011. X"u" command undos a "U" command and a 'CTRL-R' command redoes it again. When 
  1012. Xmixing "U", "u" and 'CTRL-R' you will notice that the "U" command will 
  1013. Xrestore the situation of a line to before the previous "U" command. This may 
  1014. Xbe confusing. Try it out to get used to it.
  1015. X
  1016. XThe numbered registers can also be used for undoing deletes. Each time you 
  1017. Xdelete text, it is put into register "1. The contents of register "1 are 
  1018. Xshifted to "2, etc. The contents of register "9 are lost. You can now get
  1019. Xback the most recent deleted text with the put command: '"1P'. (also, if the
  1020. Xdeleted text was the result of the last delete or copy operation, 'P' or 'p'
  1021. Xalso works as this puts the contents of the unnamed register). You can get
  1022. Xback the text of three deletes ago with '"3P'.
  1023. X
  1024. XIf you want to get back more than one part of deleted text, you can use a
  1025. Xspecial feature of the repeat command ".". It will increase the number of the
  1026. Xregister used. So if you first do ""1P", the following "." will result in a
  1027. X'"2P'. Repeating this will result in all numbered registers being inserted.
  1028. X
  1029. XExample:    If you deleted text with 'dd....' it can be restored with
  1030. X        '"1P....'.
  1031. X
  1032. XIf you don't know in which register the deleted text is, you can use the
  1033. X:display command. An alternative is to try the first register with '"1P', and
  1034. Xif it is not what you want do 'u.'. This will remove the contents of the
  1035. Xfirst put, and repeat the put command for the second register. Repeat the
  1036. X'u.' until you got what you want.
  1037. X
  1038. X
  1039. X    17. Key mapping
  1040. X
  1041. X:map {lhs} {rhs}    Map the key sequence {lhs} to {rhs} in Command mode.
  1042. X
  1043. X:map! {lhs} {rhs}    Map the key sequence {lhs} to {rhs} in Insert and
  1044. X            Command_line mode.
  1045. X
  1046. X:noremap {lhs} {rhs}    Map the key sequence {lhs} to {rhs} in Command mode. 
  1047. X            Disallow remapping of {rhs}. {not in Vi}
  1048. X
  1049. X:noremap! {lhs} {rhs}    Map the key sequence {lhs} to {rhs} in insert and
  1050. X            Command_line mode. Disallow remapping of {rhs}. {not 
  1051. X            in Vi}
  1052. X
  1053. X:unm[ap] {lhs}        Remove the mapping of {lhs} for Command mode.
  1054. X
  1055. X:unm[ap]! {lhs}        Remove the mapping of {lhs} for Insert and
  1056. X            Command_line mode.
  1057. X
  1058. X:map            List all key mappings for Command mode.
  1059. X
  1060. X:map!            List all key mappings for Insert and Command_line
  1061. X            mode.
  1062. X
  1063. X:map {lhs}        List the key mappings for the key sequences starting
  1064. X            with {lhs} in Command mode. {not in Vi}
  1065. X
  1066. X:map! {lhs}        List the key mappings for the key sequences starting
  1067. X            with {lhs} in insert and Command_line mode. {not in Vi}
  1068. X
  1069. X:cm[ap]            Same as :map, but for Command_line mode only. {not
  1070. X            in Vi}
  1071. X
  1072. X:cu[nmap]        Same as :unmap, but for Command_line mode only.
  1073. X            {not in Vi}
  1074. X
  1075. X:cno[remap]        Same as :noremap, but for Command_line mode only.
  1076. X            {not in Vi}
  1077. X
  1078. X:im[ap]            Same as :map, but for Insert mode only. {not in Vi}
  1079. X
  1080. X:iu[nmap]        Same as :unmap, but for Insert mode only. {not in
  1081. X            Vi}
  1082. X
  1083. X:ino[remap]        Same as :noremap, but for Insert mode only. {not in
  1084. X            Vi}
  1085. X
  1086. XThese commands are used to map a key or key sequence to a string of 
  1087. Xcharacters. You can use this to put command sequences under function keys, 
  1088. Xtranslate one key into another, etc. See the "Options" chapter below for how 
  1089. Xto save and restore the current mapping.
  1090. X
  1091. XThere are three sets of mappings
  1092. X- For Insert mode. These are also used in Replace mode.
  1093. X- For Command_line mode: When entering a ":" or "/" command.
  1094. X- For Command mode: When typing commands.
  1095. X
  1096. XThe original vi did not have separate mappings for Insert mode and
  1097. XCommand_line mode. Therefore the ":map!" command enters and displays
  1098. Xmappings for both. In Vim you can use the ":cmap" and ":imap" commands to
  1099. Xenter mappings for each mode separately. When listing mappings with ":map!",
  1100. X":cmap" or ":imap" the character in column 1 is <!> for mappings in both
  1101. XInsert and Command_line mode, <i> for Insert mode only and <c> for
  1102. XCommand_line mode only.
  1103. X
  1104. XEverything from the first non-blank after {lhs} up to the end of the line
  1105. X(or <|>) is considered to be part of {rhs}. This allows the {rhs} to end
  1106. Xwith a space.
  1107. X
  1108. XTo include a space in {lhs} precede it with a CTRL-V (type two CTRL-Vs for 
  1109. Xeach space). If you want a {rhs} that starts with a space, precede {rhs} 
  1110. Xwith a single CTRL-V (You have to type CTRL-V two times). You can create an 
  1111. Xempty {rhs} by typing nothing after the two CTRL-Vs.
  1112. X
  1113. XIt is not possible to put a comment after this command, because the <"> 
  1114. Xcharacter is considered to be part of the {rhs}. To put a <|> in {rhs} 
  1115. Xescape it with a backslash or a CTRL-V (to get one CTRL-V you have to type 
  1116. Xit twice).
  1117. X
  1118. XTo avoid mapping of the characters you type in insert or Command_line mode, 
  1119. Xtype a CTRL-V first. The mapping in Insert mode is disabled if the 'paste'
  1120. Xoption is set.
  1121. X
  1122. XNote that the second character (argument) of the commands @zZtTfF[]rm'`"v is
  1123. Xnot mapped. This was done to be able to use all the named registers and
  1124. Xmarks, even when the command with the same name has been mapped.
  1125. X
  1126. XSome examples (given as you type them; e.g. the "^V" is CTRL-V which you 
  1127. Xtype, but will not show up on the screen):
  1128. X
  1129. X    :map g /foo^V^Mcwbar^V^[    (replace next "foo" by "bar")
  1130. X    :map! qq quadrillion questions
  1131. X
  1132. XVim will compare what you type with the start of a mapped sequence. If there
  1133. END_OF_FILE
  1134. if test 44166 -ne `wc -c <'vim/doc/reference.do3'`; then
  1135.     echo shar: \"'vim/doc/reference.do3'\" unpacked with wrong size!
  1136. fi
  1137. chmod +x 'vim/doc/reference.do3'
  1138. # end of 'vim/doc/reference.do3'
  1139. fi
  1140. echo shar: End of archive 21 \(of 25\).
  1141. cp /dev/null ark21isdone
  1142. MISSING=""
  1143. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 ; do
  1144.     if test ! -f ark${I}isdone ; then
  1145.     MISSING="${MISSING} ${I}"
  1146.     fi
  1147. done
  1148. if test "${MISSING}" = "" ; then
  1149.     echo You have unpacked all 25 archives.
  1150.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1151. else
  1152.     echo You still need to unpack the following archives:
  1153.     echo "        " ${MISSING}
  1154. fi
  1155. ##  End of shell archive.
  1156. exit 0
  1157.  
  1158. ===============================================================================
  1159. Bram Moolenaar                             | DISCLAIMER:  This  note  does  not
  1160. Oce Nederland B.V., Research & Development | necessarily represent the position
  1161. p.o. box 101, 5900 MA  Venlo               | of  Oce-Nederland  B.V.  Therefore
  1162. The Netherlands        phone +31 77 594077 | no liability or responsibility for
  1163. UUCP: mool@oce.nl        fax +31 77 595473 | whatever will be accepted.
  1164.  
  1165. exit 0 # Just in case...
  1166.