home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume37 / vim / part20 < prev    next >
Text File  |  1993-04-24  |  50KB  |  1,260 lines

  1. Newsgroups: comp.sources.misc
  2. From: mool@oce.nl (Bram Moolenaar)
  3. Subject: v37i020:  vim - Vi IMitation editor v1.27, Part20/24
  4. Message-ID: <1993Apr25.013816.23275@sparky.imd.sterling.com>
  5. X-Md4-Signature: 512b2a82e66cfeeb1df7f9f2842ad156
  6. Date: Sun, 25 Apr 1993 01:38:16 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: mool@oce.nl (Bram Moolenaar)
  10. Posting-number: Volume 37, Issue 20
  11. Archive-name: vim/part20
  12. Environment: UNIX, AMIGA, MS-DOS
  13.  
  14. #! /bin/sh
  15. # This is a shell archive.  Remove anything before this line, then unpack
  16. # it by saving it into a file and typing "sh file".  To overwrite existing
  17. # files, type "sh file -c".  You can also feed this as standard input via
  18. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  19. # will see the following message at the end:
  20. #        "End of archive 20 (of 23)."
  21. # Contents:  vim/doc/reference.doc2
  22. # Wrapped by mool@oce-rd2 on Mon Apr 19 15:50:13 1993
  23. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  24. if test -f 'vim/doc/reference.doc2' -a "${1}" != "-c" ; then 
  25.   echo shar: Will not clobber existing file \"'vim/doc/reference.doc2'\"
  26. else
  27. echo shar: Extracting \"'vim/doc/reference.doc2'\" \(46054 characters\)
  28. sed "s/^X//" >'vim/doc/reference.doc2' <<'END_OF_FILE'
  29. X            (inclusive).
  30. X
  31. X;            Repeat latest f, t, F or T [cnt] times.
  32. X
  33. X,            Repeat latest f, t, F or T in opposite direction
  34. X            [cnt] times.
  35. X
  36. XThese commands move the cursor to the specified column in the current line.
  37. XThey stop at the first column and at the end of the line, except '$', which 
  38. Xmay move to one of the next lines.
  39. X
  40. X
  41. X6.2 Up-down motions
  42. X
  43. Xk        or
  44. X<C_UP>        or
  45. XCTRL-P            [cnt] lines upward (linewise).
  46. X
  47. Xj        or
  48. X<C_DOWN>    or
  49. XCTRL-J        or
  50. X<LF>        or
  51. XCTRL-N            [cnt] lines downward (linewise).
  52. X
  53. X-  <minus>        [cnt] lines upward, on the first non-blank character
  54. X            (linewise).
  55. X
  56. X+        or
  57. XCTRL-M        or
  58. X<CR>            [cnt] lines downward, on the first non-blank
  59. X            character (linewise).
  60. X
  61. X_  <underscore>        [cnt] - 1 lines downward, on the first non-blank
  62. X            character (linewise).
  63. X
  64. XG            Goto line [cnt], default last line, on the first
  65. X            non-blank character (linewise).
  66. X
  67. X:[range]        Set the cursor on the (last) specified line number
  68. X            (cannot be used with an operator).
  69. X
  70. X{cnt}%            Go to {cnt} percentage in the file, column 1 
  71. X            (linewise). To compute the new line number this 
  72. X            formula is used: {cnt} * number-of-lines / 100. {not 
  73. X            in Vi}
  74. X
  75. XThese commands move to the specified line. They stop when reaching the first 
  76. Xor the last line. The first two commands put the cursor in the same column 
  77. X(if possible) as it was after the last command that changed the column, 
  78. Xexcept after the '$' command, then the cursor will be put on the last 
  79. Xcharacter of the line.
  80. X
  81. X
  82. X6.3 Word motions
  83. X
  84. X<SC_RIGHT>    or
  85. Xw            [cnt] words forward (exclusive).
  86. X
  87. XW            [cnt] WORDS forward (exclusive).
  88. X
  89. Xe            Forward to the end of word [cnt] (inclusive).
  90. X
  91. XE            Forward to the end of WORD [cnt] (inclusive).
  92. X
  93. X<SC_LEFT>    or
  94. Xb            [cnt] words backward (exclusive).
  95. X
  96. XB            [cnt] WORDS backward (exclusive).
  97. X
  98. XThese commands move over words or WORDS. A word consists of a sequence of 
  99. Xletters, digits and underscores, or a sequence of other non-blank 
  100. Xcharacters, separated with blank space. A WORD consists of a sequence of 
  101. Xnon-blank characters, separated with blank space. The end of a line is also 
  102. Xconsidered to be blank space. An empty line is also considered to be a word 
  103. Xand a WORD.
  104. X
  105. XSpecial case: "cw" and "cW" are treated like "ce" and "cE" if the cursor is 
  106. Xon a non-blank. This is because "cw" is interpreted as change-word, and a 
  107. Xword does not include the following blank space. {Vi: "cw" when on a blank 
  108. Xfollowed by other blanks changes only the first blank; this is probably a 
  109. Xbug, because "dw" deletes all the blanks}
  110. X
  111. X
  112. X6.4 Text object motions
  113. X
  114. X(            [cnt] sentences backward (exclusive).
  115. X
  116. X)            [cnt] sentences forward (exclusive).
  117. X
  118. X{            [cnt] paragraphs backward (exclusive).
  119. X
  120. X}            [cnt] paragraphs forward (exclusive).
  121. X
  122. X]]            [cnt] sections forward, except when used after an
  123. X            operator, then [cnt] SECTIONS forward (linewise).
  124. X
  125. X][            [cnt] SECTIONS forward (linewise).
  126. X
  127. X[[            [cnt] sections backward (linewise).
  128. X
  129. X[]            [cnt] SECTIONS backward (linewise).
  130. X
  131. XThese commands move over three kinds of text objects.
  132. X
  133. XA sentence is defined as ending at a '.', '!' or '?' followed by either the 
  134. Xend of a line, or by a space. {Vi: two spaces} Any number of closing ')', 
  135. X']', '"' and ''' characters my appear after the '.', '!' or '?' before the 
  136. Xspaces or end of line. A paragraph and section boundary is also a sentence 
  137. Xboundary.
  138. X
  139. XA paragraph begins after each empty line, and also at each of a set of 
  140. Xparagraph macros, specified by the pairs of characters in the 'paragraphs' 
  141. Xoption. The default is "IPLPPPQPP LIpplpipbp", which corresponds to the 
  142. Xmacros ".IP", ".LP", etc. (these are nroff macros, the dot must be in the 
  143. Xfirst column). A section boundary is also a paragraph boundary.
  144. X
  145. XA section begins after a form-feed in the first column, a '{' in the first 
  146. Xcolumn, and also at each of a set of section macros, specified by the pairs 
  147. Xof characters in the 'sections' option. The default is "SHNHH HUnhsh". A 
  148. XSECTION is the same as a section, except that a '}' replaces the '{'. This 
  149. Xis useful to find the end of C-language functions.
  150. X
  151. X
  152. X6.5 Pattern searches
  153. X
  154. X/{pattern}[/]        Search forward for the [cnt]'th occurrence of
  155. X            {pattern} (exclusive).
  156. X
  157. X/{pattern}/{offset}    Search forward for the [cnt]'th occurrence of
  158. X            {pattern} and go {offset} lines up or down (see 
  159. X            below). (linewise).
  160. X
  161. X/            Search forward for the [cnt]'th latest used pattern 
  162. X            with latest used {offset}.
  163. X
  164. X//{offset}        Search forward for the [cnt]'th latest used pattern 
  165. X            with new {offset}. If {offset} is empty no offset is 
  166. X            used.
  167. X
  168. X*            Search forward for the [cnt]'th occurrence of the
  169. X            ident after or under the cursor (exclusive). {not in 
  170. X            Vi}
  171. X
  172. X#            Search backward for the [cnt]'th occurrence of the
  173. X            ident after or under the cursor (exclusive). {not in 
  174. X            Vi}
  175. X
  176. X?{pattern}[?]        Search backward for the [cnt]'th previous
  177. X            occurrence of {pattern} (exclusive).
  178. X
  179. X?{pattern}?{offset}    Search backward for the [cnt]'th previous occurrence
  180. X            of {pattern} and go {offset} lines up or down (see 
  181. X            below) (linewise).
  182. X
  183. X?            Search backward for the [cnt]'th latest used pattern 
  184. X            with latest used {offset}.
  185. X
  186. X??{offset}        Search backward for the [cnt]'th latest used pattern 
  187. X            with new {offset}. If {offset} is empty no offset is 
  188. X            used.
  189. X
  190. Xn            Repeat the latest '/' or '?' [cnt] times. {Vi: no
  191. X            count}
  192. X
  193. XN            Repeat the latest '/' or '?' [cnt] times in opposite
  194. X            direction. {Vi: no count}
  195. X
  196. XCTRL-C            Interrupt current (search) command.
  197. X
  198. XThese commands search for the specified pattern. With "/" and "?" an 
  199. Xadditional offset may be given. There are two types of offsets: line offsets 
  200. Xand character offsets. {the character offsets are not in Vi}
  201. X
  202. XThe offset gives the cursor positition relative to the found match:
  203. X    +[num]    [num] lines downwards, in column 1
  204. X    -[num]    [num] lines upwards, in column 1
  205. X    e[+num]    [num] characters to the right of the end of the match
  206. X    e[-num]    [num] characters to the left of the end of the match
  207. X    s[+num]    [num] characters to the right of the start of the match
  208. X    s[-num]    [num] characters to the left of the start of the match
  209. X    n        not an offset: search without setting the current position
  210. X            of the cursor (used for the :tags command)
  211. X
  212. XIf [num] is omitted it is assumed to be zero.
  213. X
  214. XExamples:
  215. X
  216. Xpattern            cursor position
  217. X/test/+1        one line below "test", in column 1
  218. X/test/e            on the last t of "test"
  219. X/test/s+2        on the "s" of "test"
  220. X
  221. XIf one of these commands is used after an operator, the characters between 
  222. Xthe cursor position before and after the search is affected. However, if a 
  223. Xline offset is given, the whole lines between the two cursor positions are 
  224. Xaffected.
  225. X
  226. XThe last used <pattern> and <offset> are remembered. They can be used to
  227. Xrepeat the search, possibly in another direction or with another count. Note
  228. Xthat only one <pattern> is remembered for all searches, including :s
  229. X(substitute). Each time an empty <pattern> is given, the previously used
  230. X<pattern> is used.
  231. X
  232. XIf the 'wrapscan' option is set (which is the default), searches wrap around 
  233. Xthe end of the buffer. If 'wrapscan' is not set, the backward search stops 
  234. Xat the beginning and the forward search stops at the end of the buffer. If 
  235. Xthe pattern was not found the error message "pattern not found" is given, 
  236. Xand the cursor will not be moved.
  237. X
  238. XPatterns may contain special characters, depending on the setting of the
  239. X'magic' option. The '*' and '#' commands search for the identifier currently
  240. Xunder the cursor. If there is no indentifier under the cursor, the first one 
  241. Xto the right is used. This identifier may only contain letters, digits and 
  242. Xunderscores. Note that if you type with ten fingers, the characters are easy 
  243. Xto remember: the '#' is under your left hand middle finger and the '*' is 
  244. Xunder your right hand middle finger.
  245. X
  246. XThe definition of a pattern:
  247. X
  248. X1.  A pattern is one or more branches, separated by '\|'. It matches anything
  249. X    that matches one of the branches.
  250. X
  251. X2.  A branch is one or more pieces, concatenated. It matches a match for the
  252. X    first, followed by a match for the second, etc.
  253. X
  254. X3.  A piece is an atom, possibly followed by:
  255. X      magic    nomagic
  256. X    *      \*        matches 0 or more of the preceding atom
  257. X    \+      \+        matches 1 or more of the preceding atom {not
  258. X                in Vi}
  259. X    \?      \?        matches 0 or 1 of the preceding atom {not in
  260. X                Vi}
  261. X
  262. X4.  An atom can be:
  263. X    - One of these five:
  264. X      magic    nomagic
  265. X    .      \.        matches any single character
  266. X    \<      \<        matches the beginning of a word
  267. X    \>      \>        matches the end of a word
  268. X    ^      ^        at beginning of pattern, matches start of
  269. X                line
  270. X    $      $        at end of pattern, matches end of line
  271. X    - A pattern enclosed by escaped parentheses (e.g. "\(^a\)").
  272. X    - A single character, with no special meaning, matches itself
  273. X    - A backslash followed by a single character, with no special meaning,
  274. X      matches the single character.
  275. X    - A range. This is a sequence of characters enclosed in '[]' with the 
  276. X      'magic' option, or enclosed in '\[]' with the 'nomagic' option. It 
  277. X      normally matches any single character from the sequence. If the 
  278. X      sequence begins with '^', it matches any single character NOT in the 
  279. X      sequence. If two characters in the sequence are separated by '-', this 
  280. X      is shorthand for the full list of ASCII characters between them (e.g. 
  281. X      '[0-9]' matches any decimal digit). To include a literal ']' in the 
  282. X      sequence, make it the first character (following a possible '^'). To 
  283. X      include a literal '\-', make it the first or last character.
  284. X
  285. XIf the 'ignorecase' option is set, the case of letters is ignored.
  286. X
  287. X<NUL> characters in the file are stored as <LF> in memory. To match them use
  288. X<LF>, which can be typed with CTRL_V CTRL_J. Note that the <NUL> character is
  289. Xdisplayed as "^@".
  290. X
  291. XExamples:
  292. X^beep(            Probably the start of the C function "beep".
  293. X
  294. X[a-zA-Z]$        Any alphabetic character at the end of a line.
  295. X
  296. X\(^\|[^a-zA-Z0-9_]\)[a-zA-Z_]\+[a-zA-Z0-9_]*
  297. X            A C identifier (will stop in front of it).
  298. X
  299. X[.!?][])"']*\($\|[ ]\)    A search pattern that finds the end of a sentence,
  300. X            with almost the same definition as the <)> command.
  301. X
  302. X
  303. X
  304. X6.6 Various motions
  305. X
  306. Xm<a-zA-Z>        Set mark <a-zA-Z> at cursor position (does not move 
  307. X            the cursor, this is not a motion command).
  308. X
  309. X:[range]mar[k] <a-zA-Z>    Set mark <a-zA-Z> at last line number in [range], 
  310. X            column 0. Default is cursor line.
  311. X
  312. X:[range]k<a-zA-Z>    Same as :mark, but the space before the mark name can
  313. X            be omitted.
  314. X
  315. X'<a-z>            To the first non-blank character on the line with
  316. X            mark <a-z> (linewise).
  317. X
  318. X'<A-Z>            To the first non-blank character on the line with
  319. X            mark <A-Z> in the correct file (linewise when in 
  320. X            same file, not a motion command when in other file). 
  321. X            {not in Vi}
  322. X
  323. X`<a-z>            To the mark <a-z> (exclusive).
  324. X
  325. X`<A-Z>            To the mark <A-Z> in the correct file (exclusive 
  326. X            when in same file, not a motion command when in 
  327. X            other file). {not in Vi}
  328. X
  329. X:marks            List the current marks (not a motion command). {not 
  330. X            in Vi}
  331. X
  332. XA mark is not visible in any way. It is just a position in the file that is
  333. Xremembered. Do not confuse marks with named registers, they are totally 
  334. Xunrelated.
  335. X
  336. XLowercase marks are only remembered as long as you stay in the current
  337. Xfile. If you start editing another file, change a character in a line or 
  338. Xdelete a line that contains a mark, that mark is erased. Lowercase marks can 
  339. Xbe used in combination with operators. For example: "d't" deletes the lines 
  340. Xfrom the cursor position to mark a. Hint: Use mark <t> for Top, <b> for 
  341. XBottom, etc..
  342. X
  343. XUppercase marks include the file name. {Vi: no uppercase marks} You can use 
  344. Xthem to jump from file to file. You can only use an uppercase mark with 
  345. Xan operator if the mark is in the current file. As long as you stay in the 
  346. Xcurrent file the line number of the mark remains correct, even if you 
  347. Xinsert/delete lines. After changing files the line number may be wrong 
  348. X(keeping them correct would take too much time). To avoid this use a 
  349. X":marks" command before abandoning a file, this will update the line numbers 
  350. Xin the current file.
  351. X
  352. X
  353. X'[            To the first non-blank character on the first line 
  354. X            of the previously operated text or start of the last 
  355. X            putted text. {not in Vi}
  356. X
  357. X`[            To the first character of the previously operated 
  358. X            text or start of the last putted text. {not in Vi}
  359. X
  360. X']            To the first non-blank character on the last line of 
  361. X            the previously operated text or end of the last 
  362. X            putted text. {not in Vi}
  363. X
  364. X`]            To the last character of the previously operated 
  365. X            text or end of the last putted text. {not in Vi}
  366. X
  367. XAfter executing an operator the Cursor is put at the beginning of the text 
  368. Xthat was operated upon. After a put command ("p" or "P") the cursor is 
  369. Xsometimes placed at the first inserted line and somtimes on the last 
  370. Xinserted character. The four commands above put the cursor at either
  371. Xend. Example: After yanking 10 lines you want to go to the last one of them: 
  372. X"10Y']". After inserting several lines with the "p" command you want to jump 
  373. Xto the lowest inserted line: "p']".
  374. X
  375. XNote: After deleting text, the start and end positions are the same, except 
  376. Xwhen using blockwise quoting. These commands do not work when no operator 
  377. Xor put command has been used yet in the current file. The position may be 
  378. Xincorrect after inserting text and ".p.
  379. X
  380. X
  381. X''            To the first non-blank character of the line where
  382. X            the cursor was before the latest jump (linewise).
  383. X
  384. X``            To the position before latest jump (exclusive).
  385. X
  386. XA "jump" is one of the following commands: "'", "`", "G", "/", "?", "n", 
  387. X"N", "%", "(", ")", "[[", "]]", "{", "}", ":s", ":tag" and the commands that 
  388. Xstart editing a new file. If you make the cursor "jump" with one of these 
  389. Xcommands, the position of the cursor before the jump is remembered. You can 
  390. Xreturn to that position with the "''" and "``" command, unless the line 
  391. Xcontaining that position was changed or deleted.
  392. X
  393. XCTRL-O            Go to [cnt] Older cursor position in jump list
  394. X            (not a motion command). {not in Vi}
  395. X
  396. XCTRL-I            Go to [cnt] newer cursor position in jump list
  397. X            (not a motion command). {not in Vi}
  398. X
  399. X:jumps            Print the jump list (not a motion command). {not in 
  400. X            Vi} 
  401. X
  402. XJumps are remembered in a jump list. With the CTRL-O and CTRL-I command you 
  403. Xcan go to cursor positions before older jumps, and back again. Thus you can 
  404. Xmove up and down the list.
  405. X
  406. XFor example, after three jump commands you have this jump list:
  407. X
  408. X jump line  file
  409. X   1     1  -current-
  410. X   2    70  -current-
  411. X   3  1154  -current-
  412. X>
  413. X
  414. XYou are currently in line 1167. If you then use the CTRL-O command, the 
  415. Xcursor is put in line 1154. This results in:
  416. X
  417. X jump line  file
  418. X   1     1  -current-
  419. X   2    70  -current-
  420. X>  3  1154  -current-
  421. X   4  1167  -current-
  422. X
  423. XThe pointer will be set at the last used jump position. The next CTRL-O 
  424. Xcommand will use the entry above it, the next CTRL-I command will use the 
  425. Xentry below it. If the pointer is below the last entry, this indicates that 
  426. Xyou did not use a CTRL-I or CTRL-O before. In this case the CTRL-O command 
  427. Xwill cause the cursor position to be added to the jump list, so you can get 
  428. Xback to the postition before the CTRL-O. In this case this is line 1167.
  429. X
  430. XWith more CTRL-O commands you will go to lines 70 and 1. If you use CTRL-I 
  431. Xyou can go back to 1154 and 1167 again.
  432. X
  433. XIf you use a jump command, the current line number is inserted at the end of 
  434. Xthe jump list. If you used CTRL-O or CTRL-I just before that, the same line 
  435. Xmay be in the list twice. This may be a bit strange. Just try it and look at 
  436. Xthe jump list with the :jumps command. Note that this behaviour is different 
  437. Xfrom the tag stack.
  438. X
  439. XAfter the CTRL-O command that got you into line 1154 you could give another 
  440. Xjump command (e.g. 'G'). The jump list would then become:
  441. X
  442. X jump line  file
  443. X   1     1  -current-
  444. X   2    70  -current-
  445. X   3  1154  -current-
  446. X   4  1167  -current-
  447. X   5  1154  -current-
  448. X>
  449. X
  450. XAs long as you stay in the same file, the line numbers will be adjusted for 
  451. Xdeleted and inserted lines. If you go to another file the line numbers may 
  452. Xbe wrong (keeping them correct would take too much time). If you want to 
  453. Xavoid this use a :jumps command before changing files. This will update the 
  454. Xline numbers in the current file.
  455. X
  456. X%            Find the next parenthesis or (curly/square) bracket
  457. X            on this line and go to its match (inclusive). No 
  458. X            count is allowed.
  459. X
  460. XH            To line [cnt] from top (Home) of screen (default:
  461. X            first line on the screen) on the first non-blank 
  462. X            character (linewise).
  463. X
  464. XM            To Middle line of screen, on the first non-blank
  465. X            character (linewise).
  466. X
  467. XL            To line [cnt] from bottom of screen (default: Last
  468. X            line on the screen) on the first non-blank character 
  469. X            (linewise).
  470. X
  471. X
  472. X    7. Scrolling
  473. X
  474. XUpwards scrolling, window goes downwards:
  475. X
  476. XCTRL-E            Window [cnt] lines downwards in the buffer ([cnt]
  477. X            lines Extra).
  478. X
  479. XCTRL-D            Window [cnt] lines Downwards in the buffer (default:
  480. X            previous [cnt] or half a screen).
  481. X
  482. X<SC_DOWN>    or
  483. XCTRL-F            Window [cnt] pages Forwards (downwards) in the
  484. X            buffer.
  485. X
  486. XDownwards scrolling, window goes upwards:
  487. X
  488. XCTRL-Y            Window [cnt] lines upwards in the buffer.
  489. X
  490. XCTRL-U            Window [cnt] lines Upwards in the buffer (default:
  491. X            previous [cnt] or half a screen).
  492. X
  493. X<SC_UP>        or
  494. XCTRL-B            Window [cnt] pages Backwards (upwards) in the buffer.
  495. X
  496. Xz<CR>            Redraw, line [cnt] at top of window (default cursor 
  497. X            line).
  498. X
  499. Xz{height}<CR>        Redraw, make window {height} lines tall (if the 
  500. X            height is different from the number of lines for the 
  501. X            current terminal, this may cause problems with 
  502. X            screen updating).
  503. X
  504. Xz.            Redraw, line [cnt] at center of window (default 
  505. X            cursor line).
  506. X
  507. Xz-            Redraw, line [cnt] at bottom of window (default 
  508. X            cursor line).
  509. X
  510. XThese commands move the contents of the window. If the cursor position is 
  511. Xmoved off of the window, the cursor is moved onto the window. A page is the 
  512. Xnumber of lines in the window minus two. The mnemonics for these commands 
  513. Xmay be a bit confusing. Remember that the commands refer to moving the 
  514. Xwindow upwards or downwards in the buffer. But when the window moves upwards 
  515. Xin the buffer, the text in the window moves downwards on your screen.
  516. X
  517. X
  518. X    8. Tags
  519. X
  520. X:ta[g][!] {ident}    Jump to the definition of {ident}, using the
  521. X            information in the tags file. Put {ident} in the tag
  522. X            stack. See below for [!].
  523. X
  524. XCTRL-]            ":ta" to the identifier under or after cursor. Put 
  525. X            the identifier in the tag stack. {Vi: identifier 
  526. X            after the cursor}
  527. X
  528. XCTRL-T            Jump to [cnt] older entry in the tag stack (default
  529. X            1). {not in Vi}
  530. X
  531. X:[count]po[p][!]    Jump to [count] older entry in tag stack (default 1).
  532. X            See below for [!]. {not in Vi}
  533. X
  534. X:[count]ta[g][!]    Jump to [count] newer entry in tag stack (default 1).
  535. X            See below for [!]. {not in Vi}
  536. X
  537. X:tags            Show the contents of the tag stack. The active
  538. X            entry is marked with a '>'. {not in Vi}
  539. X
  540. XA tag is an identifier that appears in the "tags" file. It is a sort of label
  541. Xthat can be jumped to. For example: In C programs each function name can be 
  542. Xused as a tag.
  543. X
  544. XWith the ":tag" command the cursor will be positioned on the tag. With the
  545. XCTRL-] command, the identifier on which the cursor is standing is used as the
  546. Xtag. If the cursor is not on an identifier, the first identifier rightwards 
  547. Xof the cursor is used.
  548. X
  549. XIf the tag is in the current file this will always work. Otherwise the
  550. Xperformed actions depend on whether the current file was changed, whether a !
  551. Xis added to the command and on the 'autowrite' option:
  552. X
  553. X  tag in       file        autowrite
  554. Xcurrent file  changed   !   option      action
  555. X-----------------------------------------------------------------------------
  556. X    yes         x    x     x      goto tag
  557. X    no         no    x     x      read other file, goto tag
  558. X    no        yes    yes    x   abondon current file, read other file, goto
  559. X                      tag
  560. X    no        yes    no    on  write current file, read other file, goto
  561. X                      tag
  562. X    no        yes    no   off  fail
  563. X-----------------------------------------------------------------------------
  564. X
  565. X- If the tag is in the current file, the command will always work.
  566. X- If the tag is in another file and the current file was not changed, the 
  567. X  other file will be made the current file and read into the buffer.
  568. X- If the tag is in another file, the current file was changed and a ! is 
  569. X  added to the command, the changes to the current file are lost, the other 
  570. X  file will be made the current file and read into the buffer.
  571. X- If the tag is in another file, the current file was changed and the 
  572. X  'autowrite' option is set, the current file will be written, the other 
  573. X  file will be made the current file and read into the buffer.
  574. X- If the tag is in another file, the current file was changed and the 
  575. X  'autowrite' option is not set, the command will fail. If you want to save 
  576. X  the changes, use the ":w" command and then use ":tag" without an argument. 
  577. X  This works because the tag is put on the stack anyway. If you want loose 
  578. X  the changes you can use the ":tag!" command.
  579. X
  580. XThe ":tag" command works very well for C programs. If you see a call to a
  581. Xfunction and wonder what that function does, position the cursor inside of 
  582. Xthe function name and hit CTRL-]. This will bring you to the function 
  583. Xdefinition. An easy way back is with the CTRL-T command. Also read about the 
  584. Xtag stack below.
  585. X
  586. XA tags file can be created with the external command 'ctags'. It will 
  587. Xcontain a tag for each function. Some versions of 'ctags' will also make a 
  588. Xtag for each "#defined" macro.
  589. X
  590. XThe lines in the tags file should have this format:
  591. X
  592. X    {tag}{separator}{filename}{separator}{command}
  593. X
  594. X{tag}        the identifier
  595. X{separator}    a single <TAB> or space character
  596. X{filename}    the file that contains the definition of {tag}
  597. X{command}    the Ex command that positions the cursor on the tag (it can
  598. X        be any Ex command, but normally it is a search command like 
  599. X        "/^main").
  600. X
  601. XThe 'tags' option is a list of file names separated by spaces. Each of these 
  602. Xfiles is searched for the tag. This can be used to use a different file than 
  603. Xthe default file "tags". It can also be used to access a common tags file. 
  604. XFor example:
  605. X
  606. X:set tags=tags\ s:commontags
  607. X
  608. XThe tag will first be searched for in the file "tags" in the current 
  609. Xdirectory. If it is not found there the file "s:commontags" will be searched 
  610. Xfor the tag. The backslash is required for the space to be included in the 
  611. Xstring option.
  612. X
  613. X
  614. XThe tags that you use are remembered in the tag stack. You can print this 
  615. Xstack with the ":tags" command. The result looks like this:
  616. X
  617. X  # TO tag      FROM line in file
  618. X  1 main               1  harddisk2:text/vim/test
  619. X> 2 FuncA             58  -current-
  620. X  3 FuncC            357  harddisk2:text/vim/src/amiga.c
  621. X
  622. XThis list shows the tags that you jumped to and the cursor position before that 
  623. Xjump. The older tags are at the top, the newer at the bottom.
  624. X
  625. XThe '>' points to the active entry. This is the tag that will be used by the 
  626. Xnext ":tag" command. The CTRL-T and ":pop" command will use the position 
  627. Xabove the active entry.
  628. X
  629. XThe line number and file name are remembered to be able to get back to where 
  630. Xyou were before the tag command. As long as you stay within one file the 
  631. Xline number will be correct, also when deleting/inserting lines. When you go 
  632. Xto another file the line number may not always be correct (keeping them 
  633. Xcorrect all the time would take too much time). To avoid this use the 
  634. X":tags" command before abondoning a file, which will update the line numbers 
  635. Xin the current file.
  636. X
  637. XYou can jump to previously used tags with several commands. Some examples:
  638. X
  639. X    ":pop" or CTRL-T     to position before previous tag
  640. X    {count}CTRL_T        to position before {count} older tag
  641. X    ":tag"            to newer tag
  642. X    ":0tag"         to last used tag
  643. X
  644. XThe most obvious way to use this is while browsing through the call graph of 
  645. Xa program. Consider the following call graph:
  646. X
  647. X    main  --->  FuncA  --->  FuncC
  648. X          --->  FuncB
  649. X
  650. X(Explanation: main calls FuncA and FuncB; FuncA calls FuncC).
  651. XYou can get from main to FuncA by using CTRL-] on the call to FuncA. Then 
  652. Xyou can CTRL-] to get to FuncC. If you now want to go back to main you can 
  653. Xuse CTRL-T twice. Then you can CTRL-] to FuncB.
  654. X
  655. XIf you issue a ":ta {ident}" or CTRL-] command, this tag is inserted at the 
  656. Xbottom of the stack. If the stack was full (it can hold upto 20 entries), the 
  657. Xoldest entry is deleted and the older entries shift one position up (their 
  658. Xindex number is decremented by one). If the last used entry was not at the 
  659. Xbottom, the entries below the last used one are moved to the top. This means 
  660. Xthat an old branch in the call graph is not lost, but moved to another place 
  661. Xon the tag stack. The stack above would change to:
  662. X
  663. X  # TO tag      FROM line in file
  664. X  1 FuncA             58  harddisk2:text/vim/src/main.c
  665. X  2 FuncC            357  harddisk2:text/vim/src/amiga.c
  666. X  3 main               1  harddisk2:text/vim/test
  667. X  4 FuncB             59  harddisk2:text/vim/src/main.c
  668. X>
  669. X
  670. XIn the call graph example: You can use this to go back from FuncB to FuncC 
  671. Xby hitting CTRL-T twice. This may be a bit strange. Use the :tags command to 
  672. Xfind out what will happen with CTRL-T commands.
  673. X
  674. X
  675. X    9. Inserting text
  676. X
  677. Xa            Append text after the cursor [cnt] times.
  678. X
  679. XA            Append text at the end of the line [cnt] times.
  680. X
  681. Xi            Insert text before the cursor [cnt] times.
  682. X
  683. XI            Insert text before the first CHAR on the line [cnt]
  684. X            times.
  685. X
  686. Xo            Begin a new line below the cursor and insert text,
  687. X            repeat [cnt] times. {Vi: blank [cnt] screen lines}
  688. X
  689. XO            Begin a new line above the cursor and insert text,
  690. X            repeat [cnt] times. {Vi: blank [cnt] screen lines}
  691. X
  692. XThese commands are used to start inserting text. They can be undone and
  693. Xrepeated. You can end insert mode with <ESC>. See the section "Insert and
  694. Xreplace mode" for the other special characters in insert mode. The effect of
  695. X[cnt] takes place after insert mode is exited.
  696. X
  697. X:r[ead] {name}        Insert the file {name} below the cursor.
  698. X
  699. X:{range}r[ead] {name}    Insert the file {name} below the specified line.
  700. X
  701. X:r[ead]!{cmd}        Execute {cmd} and insert its standard output below
  702. X            the cursor.
  703. X
  704. XThese commands insert the contents of a file, or the output of a command, 
  705. Xinto the buffer. They can be undone. They cannot be repeated with the "." 
  706. Xcommand. They work on a line basis, insertion starts below the line in which 
  707. Xthe cursor is, or below the specified line. To insert text above the first 
  708. Xline use the command ":0r {name}".
  709. X
  710. X
  711. X    10. Deleting text
  712. X
  713. X["x]x            Delete [cnt] characters under and after the cursor
  714. X            [into register x] (not linewise).
  715. X
  716. X["x]X            Delete [cnt] characters before the cursor [into
  717. X            register x] (not linewise).
  718. X
  719. X["x]d{motion}        Delete text that is moved over [into register x].
  720. X
  721. X["x]dd            Delete [cnt] lines [into register x] (linewise).
  722. X
  723. X["x]D            Delete the characters under the cursor until the end
  724. X            of the line and [cnt]-1 more lines [into register 
  725. X            x]; synonym for d$ (not linewise).
  726. X
  727. X{quote}["x]x    or
  728. X{quote}["x]d        Delete the quoted text [into register x] (see the 
  729. X            chapter on quoting). {not in Vi}
  730. X
  731. X{quote}["x]X    or
  732. X{quote}["x]D        Delete the quoted lines [into register x] (see the 
  733. X            chapter on quoting). {not in Vi}
  734. X
  735. X:[range]d[elete] [x]    Delete [range] lines (default: current line) [into
  736. X            register x].
  737. X
  738. X:[range]d[elete] [x] {count}
  739. X            Delete {count} lines, starting with [range] (default:
  740. X            current line, see 4.4.3) [into register x].
  741. X
  742. XThese commands delete text. They can be repeated (except ":d") and undone. 
  743. XUse quoting to delete blocks of text. See "copying" for an explanation of 
  744. Xregisters.
  745. X
  746. X
  747. XJ            Join [cnt] lines, with a minimum of two lines.
  748. X
  749. X{quote}J        Join the quoted lines, with a minimum of two lines.
  750. X            {not in Vi}
  751. X
  752. X:[range]j[oin][!]    Join [range] lines. Same as 'J', except when [!] is
  753. X            given, then no spaces will be inserted or deleted.
  754. X
  755. X:[range]j[oin][!] {count}
  756. X            Join {count} lines, starting with [range] (default:
  757. X            current line, see 4.4.3). Same as 'J', except when
  758. X            [!] is given, then no spaces will be inserted or 
  759. X            deleted.
  760. X
  761. XThese commands delete the newline between lines. This has the effect of 
  762. Xjoining them into one line. They can be repeated (except ":j") and undone. 
  763. X
  764. XOne space is inserted in place of the <NL>, unless the line ended with a 
  765. Xspace, <TAB> or the next line started with a ')'. If the next line has 
  766. Xleading blank space it is deleted first. If the 'joinspaces' option is set, 
  767. Xtwo spaces are inserted after a period.
  768. X
  769. X
  770. X    11. Changing text
  771. X
  772. XThe following commands can be used to change text, that is delete some text 
  773. Xand insert something else, with one command. They can all be undone. The 
  774. Xnon-Ex commands can be repeated with the "." command.
  775. X
  776. X
  777. X11.1 Delete and insert
  778. X
  779. XR            Enter replace mode: Each character you type replaces
  780. X            an existing character, starting with the character
  781. X            under the cursor. Repeat the entered text [cnt]-1
  782. X            times.
  783. X
  784. X["x]c{motion}        Delete {motion} text [into register x] and start
  785. X            insert.
  786. X
  787. X["x]cc            Delete [cnt] lines [into register x] and start insert
  788. X            (linewise).
  789. X
  790. X["x]C            Delete from the cursor position to the end of the
  791. X            line and [cnt]-1 more lines [into register x], and 
  792. X            start insert. Synonym for c$ (not linewise).
  793. X
  794. X["x]s            Delete [cnt] characters [into register x] and start
  795. X            insert (s stands for Substitute). Synonym for "cl"
  796. X            (not linewise).
  797. X
  798. X["x]S            Delete [cnt] lines [into register x] and start 
  799. X            insert. Synonym for "^cc" with 'autoindent' option 
  800. X            or "0cc" with 'noautoindent' option (not linewise).
  801. X
  802. X{quote}["x]c    or
  803. X{quote}["x]r    or
  804. X{quote}["x]s        Delete the quoted text [into register x] and start 
  805. X            insert (see the chapter on quoting). {not in Vi}
  806. X
  807. X{quote}["x]C    or
  808. X{quote}["x]R    or
  809. X{quote}["x]S        Delete the quoted lines [into register x] and start 
  810. X            insert (see the chapter on quoting). {not in Vi}
  811. X
  812. XYou can end insert and replace mode with <ESC>. See the section "Insert and
  813. Xreplace mode" for the other special characters in these modes. The effect of
  814. X[cnt] takes place after insert or replace mode is exited. {Vi: does not
  815. Xdirectly delete the text, but puts a '$' at the last deleted character}
  816. XSee "copying" for an explanation of registers.
  817. X
  818. XReplace mode is just like insert mode, except that for every character you 
  819. Xenter, one character is deleted. If the end of a line is reached, further 
  820. Xcharacters are appended (just like insert mode). In replace mode the 
  821. Xbackspace key only moves the cursor positition, no characters are deleted, 
  822. Xunless the 'repdel' option is set (see section "insert and replace mode").
  823. X
  824. XSpecial case: "cw" and "cW" are treated like "ce" and "cE" if the cursor is 
  825. Xon a non-blank. This is because "cw" is interpreted as change-word, and a 
  826. Xword does not include the following blank space. {Vi: "cw" when on a blank 
  827. Xfollowed by other blanks changes only the first blank; this is probably a 
  828. Xbug, because "dw" deletes all the blanks}
  829. X
  830. X
  831. X11.2 Simple changes
  832. X
  833. Xr<char>            Replace [cnt] characters by <char>.
  834. X
  835. X~            'notildeop' option: switch case of [cnt] characters
  836. X            under the cursor and move the cursor [cnt] 
  837. X            characters to the right. {Vi: no count}
  838. X
  839. X~{motion}        'tildeop' option: switch case of {motion} text. {Vi: 
  840. X            tilde cannot be used as an operator}
  841. X
  842. X{quote}~        switch case of quoted text (see the chapter on 
  843. X            quoting). {not in Vi}
  844. X
  845. X{quote}u        Make quoted text uppercase (see the chapter on 
  846. X            quoting). {not in Vi}
  847. X
  848. X{quote}U        Make quoted text lowercase (see the chapter on 
  849. X            quoting). {not in Vi}
  850. X
  851. XCTRL-A            Add [cnt] to the number at or after the cursor. {not 
  852. X            in Vi}
  853. X
  854. XCTRL-S            Subtract [cnt] from the number at or after the 
  855. X            cursor. {not in Vi}
  856. X
  857. XThe CTRL-A and CTRL-S commands work for (signed) decimal numbers and 
  858. Xunsigned octal and hexadecimal numbers. Numbers starting with '0x' or '0X' 
  859. Xare assumed to be hexadecimal. To decide whether the hexadecimal number 
  860. Xshould be printed uppercase or not, the case of the rightmost letter in the 
  861. Xnumber is considered. If there is no letter in the current number, the 
  862. Xpreviously detected case is used. Numbers starting with a '0' are considered 
  863. Xto be octal. Other numbers are decimal and may be preceded with a minus 
  864. Xsign. If the cursor is on a number, that one will be used. Otherwise the 
  865. Xnumber right of the cursor will be used.
  866. X
  867. XThe CTRL-A command is very useful in a macro. Example: How to make a 
  868. Xnumbered list.
  869. X
  870. X1. Make the first entry. The entry should start with a number.
  871. X2. Start recording: "va".
  872. X3. Yank the entry into a buffer: "Y".
  873. X4. Put a copy of the entry below the first one: "p". 
  874. X5. Increment the number: CTRL-A.
  875. X6. Stop recording: "v".
  876. X7. Repeat all this with "<count>@a".
  877. X
  878. X
  879. X<{motion}        Shift the {motion} lines one shiftwidth leftwards.
  880. X
  881. X<<            Shift [cnt] lines one shiftwidth leftwards.
  882. X
  883. X{quote}<        Shift the quoted lines one shiftwidth leftwards (see 
  884. X            the chapter on quoting). {not in Vi}
  885. X
  886. X>{motion}        Shift {motion} lines one shiftwidth rightwards.
  887. X
  888. X>>            Shift [cnt] lines one shiftwidth rightwards.
  889. X
  890. X{quote}>        Shift the quoted lines one shiftwidth rightwards 
  891. X            (see the chapter on quoting). {not in Vi}
  892. X
  893. X:[range]<        Shift [range] lines left.
  894. X
  895. X:[range]< {count}    Shift {count} lines left, starting with [range]
  896. X            (default current line, see 4.4.3).
  897. X
  898. X:[range]>        Shift {count} [range] lines right.
  899. X
  900. X:[range]> {count}    Shift {count} lines right, starting with [range]
  901. X            (default current line, see 4.4.3).
  902. X
  903. XThe ">" and "<" commands are handy for changing the indent within programs. 
  904. XThe size of the blank space which is inserted or deleted can be set with the 
  905. X'shiftwidth' option. Normally the 'shiftwidth' option is set to 8, but you 
  906. Xcan set it to e.g. 3 to make smaller indents. The shift leftwards stops when 
  907. Xthere is no indent. The shift right does not do anything with empty lines. 
  908. XIf the 'shiftround' option is set, the indent is rounded to a multiple of 
  909. X'shiftwidth'.
  910. X
  911. XV{motion}        Format the lines that were moved over. The length of 
  912. X            each line will be restricted to the width set with 
  913. X            the 'textwidth' option. If you did not set the 
  914. X            'textwidth' option, all lines will be joined 
  915. X            together. If the 'autoindent' option is set, use the 
  916. X            indent of the first line. {not in Vi}
  917. X
  918. X
  919. X11.3 Complex changes
  920. X
  921. X!{motion}{filter}    Filter {motion} text through the external program
  922. X            {filter}.
  923. X
  924. X!!{filter}        Filter [cnt] lines through the external program
  925. X            {filter}.
  926. X
  927. X{quote}!{filter}    Filter the quoted lines through the external program 
  928. X            {filter} (see the chapter on quoting). {not in Vi}
  929. X
  930. X:{range}![!]{filter} [!][arg]
  931. X            Filter {range} lines through the external program
  932. X            {filter}. The optional bangs are replaced with the
  933. X            latest given command. The optional [arg] is appended.
  934. X
  935. X={motion}        Filter {motion} lines through the external program 
  936. X            given with the 'equalprg' option (default: 
  937. X            "indent"). {Vi: when 'lisp' option is set, autoindent 
  938. X            {motion} lines}
  939. X
  940. X==            Filter [cnt] lines through the external program given 
  941. X            with the 'equalprg' option (default: indent). {not 
  942. X            in Vi}
  943. X
  944. X{quote}=        Filter the quoted lines through the external program 
  945. X            given with the 'equalprg' option (default: indent) 
  946. X            (see the chapter on quoting). {not in Vi}
  947. X
  948. XA filter is a program that accepts text at standard input, changes it in some
  949. Xway, and sends it to standard output. The commands above can be used to send
  950. Xsome text through a filter. An example of a filter is "sort", which sorts 
  951. Xlines alphabetically. The "indent" program is used to pretty indent C 
  952. Xprograms (you need a version of indent that works like a filter, not all 
  953. Xversions do that). The shell, given with the 'shell' option, is used to 
  954. Xexecute the command (See also the 'shelltype' option).
  955. XThe filter commands can be redone with '.'.
  956. X
  957. X:[range]s[ubstitute]/{pattern}/{string}/[g][c] [count]
  958. X            For each line in [range] replace the first occurrence
  959. X            of {pattern} by {string}. With option [g] all 
  960. X            occurrences in the line are replaced. With option 
  961. X            [c] each replace has to be confirmed (<y> to 
  962. X            replace, <q> to quit replacing, anything else to 
  963. X            skip). With [count] that many lines are are 
  964. X            searched, starting with the last line number in 
  965. X            [range] (default current line, see 4.4.3).
  966. X
  967. X:[range]s[ubstitute] [g][c] [count]
  968. X            Repeat last :substitute with new options and possibly
  969. X            on other lines.
  970. X
  971. X:[range]&[/{pattern}/{string}/][g][c] [count]
  972. X            Same as for :substitute.
  973. X
  974. X&            Synonym for ":s".
  975. X
  976. XIf the {pattern} for the substitute command is empty, the previously given
  977. Xpattern is used (from any search, including '/' and ":g").
  978. X
  979. XFor the definition of a pattern see 6.5, "Pattern searches".
  980. X
  981. XSome characters in {string} have a special meaning:
  982. X
  983. Xmagic    nomagic      action
  984. X  &      \&      replaced by the whole matched pattern
  985. X \&       &      replaced by &
  986. X      \0      replaced by the whole matched pattern
  987. X      \1      replaced by the matched pattern in the first pair of ()
  988. X      \2      replaced by the matched pattern in the second pair of ()
  989. X      ..      ..
  990. X      \9      replaced by the matched pattern in the ninth pair of ()
  991. X  ~      \~      replaced by the {string} of the previous substitute
  992. X \~       ~      replaced by ~
  993. X      \u      next character made uppercase
  994. X      \U      following characters made uppercase
  995. X      \l      next character made uppercase
  996. X      \L      following characters made uppercase
  997. X      \e      end of /u, /U, /l and /L
  998. X      \E      end of /u, /U, /l and /L
  999. X
  1000. XExamples:
  1001. X:s/a\|b/xxx\0xxx/g          modifies "a b"      in "xxxaxxx xxxbxxx"
  1002. X:s/\([abc]\)\([efg]\)/\2\1/g  modifies "af fa bg" in "fa fa gb"
  1003. X
  1004. XWhen using parentheses in combination with '|', like in \([ab]\)\|\([cd]\), 
  1005. Xeither the first or second pattern in parentheses did not match, so either 
  1006. X\1 or \2 is empty. Example:
  1007. X:s/\([ab]\)\|\([cd]\)/\1x/g   modifies "a b c d"  in "ax bx x x"
  1008. X
  1009. X
  1010. X    12. Copying and moving text
  1011. X
  1012. X"<a-zA-Z0-9.>        Use register <a-zA-Z0-9.> for next delete, yank or put
  1013. X            (uppercase to append) (<.> only works with put).
  1014. X
  1015. X:di[splay]        Display the contents of numbered and named registers.
  1016. X            {Vi: no such command}
  1017. X
  1018. X["x]y{motion}        Yank {motion} text [into register x].
  1019. X
  1020. X["x]yy            Yank [cnt] lines [into register x] (linewise).
  1021. X
  1022. X["x]Y            With 'noyankendofline' option: yank [cnt] lines 
  1023. X            [into register x] (synonym for yy, linewise); with 
  1024. X            'yankendofline' option: yank until end of line 
  1025. X            (synonym for y$, not linewise).
  1026. X
  1027. X{quote}["x]y        Yank the quoted text [into register x] (see the 
  1028. X            chapter on quoting). {not in Vi}
  1029. X
  1030. X{quote}["x]Y        Yank the quoted lines [into register x] (see the 
  1031. X            chapter on quoting). {not in Vi}
  1032. X
  1033. X:[range]y[ank] [x]    Yank [range] lines [into register x].
  1034. X
  1035. X:[range]y[ank] [x] {count}
  1036. X            Yank {count} lines, starting with last line number 
  1037. X            in [range] (default: current line, see 4.4.3), [into 
  1038. X            register x].
  1039. X
  1040. X["x]p            Put the text [from register x] after the cursor [cnt]
  1041. X            times. {Vi: no count}
  1042. X
  1043. X["x]P            Put the text [from register x] before the cursor
  1044. X            [cnt] times. {Vi: no count}
  1045. X
  1046. X:[line]pu[t] [x]    Put the text [from register x] after [line] (default
  1047. X            current line).
  1048. X
  1049. X:[line]pu[t]! [x]    Put the text [from register x] before [line] (default
  1050. X            current line).
  1051. X
  1052. XThese commands can be used to copy text from one place to another. This is 
  1053. Xdone by first getting the text into a register with a yank, delete or change 
  1054. Xcommand. The register can then be inserted with a put command. All registers 
  1055. Xare kept when changing files. Thus you can also use this to move text from 
  1056. Xone file to another (the CTRL-^ command is a quick way to toggle between two 
  1057. Xfiles).
  1058. X
  1059. XThe put commands can be repeated (except for :put) and undone. If the
  1060. Xcommand that was used to get the text into the register was linewise, the 
  1061. Xtext will be inserted below or above the line where the cursor is. Otherwise 
  1062. Xthe text will be inserted before or after the cursor. With the ":put" 
  1063. Xcommand the text will always be inserted in the next line. You can exchange 
  1064. Xtwo characters with the command sequence "xp". You can exchange two lines 
  1065. Xwith the command sequence "ddp". The "']" or "`]" command can be used after 
  1066. Xthe put command to move the cursor to the end of the inserted text, "'[" or 
  1067. X"`[" to move the cursor to the start.
  1068. X
  1069. XIf the command that was used to get the text into the register used 
  1070. Xblockwise quoting, the block of text will be inserted before ('P') or after 
  1071. X('p') the cursor column, in the current and next lines. Vim will make the 
  1072. Xwhole block of text start in the same column. Thus the inserted text looks 
  1073. Xthe same as when it was yanked or deleted. Some <TAB> characters may be 
  1074. Xreplaced by spaces to make this happen. However, if the width of the block 
  1075. Xis not a multiple of a <TAB> width and the text after the inserted block 
  1076. Xcontains <TAB>s, that text may be misaligned.
  1077. X
  1078. XThere are three types of registers: 10 numbered registers, 26 named 
  1079. Xregisters and one insert register.
  1080. X    The numbered registers are filled with yank and delete commands. 
  1081. XNumbered register "0" is filled with the last yank command, unless another 
  1082. Xregister was specified with ["x]. Numbered register "1" is filled with the 
  1083. Xtext that was deleted by each delete or change command, unless another 
  1084. Xregister was specified. The contents of register "1" is put in "2", "2" in 
  1085. X"3", and so forth. The contents of register "9" is lost. {Vi: numbered 
  1086. Xregister contents is lost when changing files; register 0 does not exist}
  1087. X    The named registers are only filled when you say so. They are named 
  1088. X'a' to 'z' normally. If you use an uppercase letter, the same registers as 
  1089. Xwith the lower case letter is used, but the text is appended to the previous 
  1090. Xregister contents. With a lower case letter the previous contents is lost.
  1091. X    The insert register "." contains the last inserted text. It can only 
  1092. Xbe used with the commands 'p', 'P' and ':put'.
  1093. X
  1094. XIf you use a put command without specifying a register, the register that 
  1095. Xwas last written to is used. If you are confused, use the ":dis" command to 
  1096. Xfind out what will be put.
  1097. X
  1098. XThe next three commands always work on whole lines.
  1099. X
  1100. X:[range]co[py] {address}
  1101. X            Copy the lines given by [range] to below the line
  1102. X            given by {address}.
  1103. X
  1104. X:t            Synonym for copy.
  1105. X
  1106. X:[range]m[ove] {address}
  1107. X            Move the lines given by [range] to below the line
  1108. X            given by {address}.
  1109. X
  1110. X
  1111. X    13. Quoting
  1112. X
  1113. XQuoting is a flexible and easy way to select a piece of text for an 
  1114. Xoperator. It is the only way to select a block of text.
  1115. X
  1116. Xq            start/stop quoting per character. {not in Vi}
  1117. X
  1118. XQ            start/stop quoting linewise. {not in Vi}
  1119. X
  1120. XCTRL-Q            start/stop quoting blockwise. {not in Vi}
  1121. X
  1122. Xo            go to Other end of quoted text: The current cursor 
  1123. X            position becomes the start of the quoted text and 
  1124. X            the cursor is moved to the Other end of the quoted 
  1125. X            text. {not in Vi} 
  1126. X
  1127. XTo apply an operator on a piece of text:
  1128. X    1. mark the start of the text with 'q', 'Q' or CTRL-Q
  1129. X        The character under the cursor will be used as the start.
  1130. X    2. move to the end of the text
  1131. X        The text from the start of the quoting up to and including 
  1132. X        the character under the cursor is highlighted.
  1133. X    3. hit an operator
  1134. X        The highlighted characters will be operated upon.
  1135. X
  1136. XThe quoted text includes the character under the cursor. Vim tries to invert 
  1137. Xthe cursor, but on some terminals the inverted cursor looks strange or 
  1138. Xcannot been seen at all.
  1139. X
  1140. XWith 'q' the text before the start positition and after the end position will 
  1141. Xnot be highlighted. However, All uppercase and non-alpha operators, except 
  1142. X'~', will work on whole lines anyway. See the list of operators below.
  1143. X
  1144. XWith CTRL-Q (blockwise quoting) the quoted text will be a rectangle between 
  1145. Xstart position and the cursor. However, some operators work on whole lines 
  1146. Xanyway (see the list below). The change and substitute operators will delete 
  1147. Xthe quoted text and then start insertion at the top left position.
  1148. X
  1149. XWhen the '$' command is used with blockwise quoting, the right end of the 
  1150. Xquoted text will be determined by the longest quoted line. This stops when a 
  1151. Xmotion command is used that does not move straight up or down.
  1152. X
  1153. XIf 'q', 'Q', CTRL-Q or ESC is typed while quoting, the quoting stops and no 
  1154. Xtext is affected. If you hit CTRL-Z quoting stops and the editor is 
  1155. Xsuspended or a new shell is started.
  1156. X
  1157. XFor moving the end of the block many commands can be used, but you cannot 
  1158. Xuse Ex commands, commands that make changes or abandon the file. Commands 
  1159. X(starting with) ".pPiIaAO&", CTRL_^, "ZZ", CTRL-], CTRL-T, CTRL-R, CTRL-I 
  1160. Xand CTRL-O. If you try to use one of these commands a beep is given and 
  1161. Xquoting continues. 
  1162. X
  1163. XThe operators that can be used are:
  1164. X    ~    switch case
  1165. X    d    delete
  1166. X    c    change
  1167. X    y    yank
  1168. X    >    shift right (1)
  1169. X    <    shift left (1)
  1170. X    !    filter through external command (1)
  1171. X    =    filter through 'equalprg' option command (1)
  1172. X    V    format lines to 'textwidth' length (1)
  1173. X
  1174. XAdditionally the following commands can be used:
  1175. X    :    start ex command for quoted lines (1)
  1176. X    r    change
  1177. X    s    change
  1178. X    C    change (2)
  1179. X    R    change (2)
  1180. X    S    change (2)
  1181. X    x    delete
  1182. X    D    delete (2)
  1183. X    X    delete (2)
  1184. X    Y    yank (2)
  1185. X    J    join (1)
  1186. X    u    make uppercase
  1187. X    U    make lowercase
  1188. X
  1189. X(1): always whole lines
  1190. X(2): whole lines when not using CTRL-Q
  1191. X
  1192. XIf you want to give a buffer name using the '"' command, do this just before 
  1193. Xtyping the operator character.
  1194. X
  1195. XWhen repeating a quoted operator, the operator will be applied to the same 
  1196. Xamount of text as the last time:
  1197. X- Linewise quoting: The same number of lines.
  1198. X- Blockwise quoting: The same number of lines and columns.
  1199. X- Normal quoting within one line: The same number of characters.
  1200. X- Normal quoting with several lines: The same number of lines, in the last 
  1201. X  line the same number of characters as in the last line the last time.
  1202. XThe start of the text is the Cursor position. If the '$' command was used as 
  1203. Xone of the last commands to extend the quoted text, the repeating will be 
  1204. Xapplied upto the rightmost column of the longest line.
  1205. X
  1206. X
  1207. X    14. Various commands
  1208. X
  1209. XCTRL-L            Clear and redraw the screen.
  1210. X
  1211. XCTRL-Z            On Unix systems: Suspend Vim. On other systems: 
  1212. X            start a new shell (like ":sh").
  1213. X
  1214. X<HELP>        or
  1215. X:h[elp]            Show the help file page by page. The help file name 
  1216. X            can be set with the 'helpfile' option. {Vi: no help}
  1217. X
  1218. X<DEL>            When entering a number: remove the last digit.
  1219. X
  1220. X:[range]p[rint]        Print [range] lines (default current line).
  1221. X
  1222. X:[range]p[rint] {count}
  1223. X            Print {count} lines, starting with [range] (default
  1224. X            current line, see 4.4.3).
  1225. X
  1226. X:=            Print the line number.
  1227. X
  1228. X:sh[ell]        Escape to a shell (name from 'shell' option).
  1229. END_OF_FILE
  1230. if test 46054 -ne `wc -c <'vim/doc/reference.doc2'`; then
  1231.     echo shar: \"'vim/doc/reference.doc2'\" unpacked with wrong size!
  1232. fi
  1233. # end of 'vim/doc/reference.doc2'
  1234. fi
  1235. echo shar: End of archive 20 \(of 23\).
  1236. cp /dev/null ark20isdone
  1237. MISSING=""
  1238. 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 ; do
  1239.     if test ! -f ark${I}isdone ; then
  1240.     MISSING="${MISSING} ${I}"
  1241.     fi
  1242. done
  1243. if test "${MISSING}" = "" ; then
  1244.     echo You have unpacked all 23 archives.
  1245.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1246. else
  1247.     echo You still need to unpack the following archives:
  1248.     echo "        " ${MISSING}
  1249. fi
  1250. ##  End of shell archive.
  1251. exit 0
  1252. -------------8<----------------8<----------------8<---------------8<--------
  1253. Bram Moolenaar                             | DISCLAIMER:  This  note  does  not
  1254. Oce Nederland B.V., Research & Development | necessarily represent the position
  1255. p.o. box 101, 5900 MA  Venlo               | of  Oce-Nederland  B.V.  Therefore
  1256. The Netherlands        phone +31 77 594077 | no liability or responsibility for
  1257. UUCP: mool@oce.nl        fax +31 77 595450 | whatever will be accepted.
  1258.  
  1259. exit 0 # Just in case...
  1260.