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

  1. Newsgroups: comp.sources.misc
  2. From: mool@oce.nl (Bram Moolenaar)
  3. Subject: v41i073:  vim - Vi IMitation editor, v2.0, Part23/25
  4. Message-ID: <1993Dec21.173042.2504@sparky.sterling.com>
  5. X-Md4-Signature: 059a50556065a2c40f01d507ec67fb8b
  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:30:42 GMT
  10. Approved: kent@sparky.sterling.com
  11.  
  12. Submitted-by: mool@oce.nl (Bram Moolenaar)
  13. Posting-number: Volume 41, Issue 73
  14. Archive-name: vim/part23
  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 23 (of 25)."
  25. # Contents:  vim/doc/reference.do1
  26. # Wrapped by mool@oce-rd2 on Wed Dec 15 09:50:09 1993
  27. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  28. if test -f 'vim/doc/reference.do1' -a "${1}" != "-c" ; then 
  29.   echo shar: Will not clobber existing file \"'vim/doc/reference.do1'\"
  30. else
  31. echo shar: Extracting \"'vim/doc/reference.do1'\" \(47200 characters\)
  32. sed "s/^X//" >'vim/doc/reference.do1' <<'END_OF_FILE'
  33. X
  34. X
  35. X
  36. X            Vim reference manual
  37. X
  38. X             By Bram Moolenaar
  39. X
  40. X               version 2.0
  41. X
  42. X
  43. X 1. Introduction
  44. X 2. Notation
  45. X 3. Starting Vim
  46. X 4. Modes
  47. X 5. Editing files
  48. X 6. Cursor motions
  49. X 7. Scrolling
  50. X 8. Tags
  51. X 9. Inserting text
  52. X10. Deleting text
  53. X11. Changing text
  54. X12. Copying and moving text
  55. X13. Visual mode
  56. X14. Various commands
  57. X15. Repeating commands
  58. X16. Undo and redo
  59. X17. Key mapping
  60. X18. Recovery after a crash
  61. X19. Options
  62. X20. Terminal information
  63. X21. Differences from Vi and Ex
  64. X22. Credits
  65. X
  66. X
  67. X    1. Introduction
  68. X
  69. XVim stands for Vi IMproved. It used to be Vi IMitation, but that does not
  70. Xreally cover it anymore. Vim is a text editor which includes almost all the
  71. Xcommands from the Unix program "Vi". It is very useful for editing programs
  72. Xand other ASCII text. All commands are given with the keyboard. There is no
  73. Xmouse support and there are no menus. This gives the advantage that you can
  74. Xkeep your fingers on the keyboard and your eyes on the screen.
  75. X
  76. XThroughout this manual the differences between Vi and Vim are mentioned in 
  77. Xcurly braces. Read the file "difference.doc" for a summary of the 
  78. Xdifferences.
  79. X
  80. XThis manual refers to Vim on the Commodore Amiga computer. On other 
  81. Xcomputers and on terminals there may be small differences. For MSDOS this 
  82. Xis documented in msdos.doc. For UNIX this is in unix.doc.
  83. X
  84. XThis manual is a reference for all the Vim commands and options. A basic
  85. Xknowledge of "Vi" is assumed. A summary of this manual can be found in the 
  86. Xfile vim.hlp. It can be accessed from within Vim with the <HELP> key (in 
  87. XMSDOS <F1>) and with the command ":help". The 'helpfile' option can be 
  88. Xset to the name of the help file, so you can put it in any place you like.
  89. X
  90. X
  91. X    2. Notation
  92. X
  93. X[]        Characters in square brackets are optional.
  94. X
  95. X[count]        An optional number that may precede the command to multiply
  96. X        or iterate the command. If no number is given a count of one
  97. X        is used, unless otherwise noted. Note that in this manual
  98. X        the [count] is not mentioned in the description of the
  99. X        command, but only in the explanation. This was done to make
  100. X        the commands easier to lookup. If the "sc" option is on, the
  101. X        (partially) entered count is shown at the bottom of the
  102. X        window. You can use <DEL> to erase the last digit.
  103. X
  104. X["x]        An optional register designation where text can be stored.
  105. X        The x is a single character between <a> and <z> or <A> and
  106. X        <Z> or <">, and in some cases (with the put command) between
  107. X        <0> and <9>, <%> or <.>. The uppercase and lower case letter
  108. X        designate the same register, but the lower case letter is
  109. X        used to overwrite the previous register contents, while the
  110. X        uppercase letter is used to append to the previous register
  111. X        contents. Without the ""x" or with """" the stored text is
  112. X        put into the unnamed register. See also "Copying and moving
  113. X        text".
  114. X
  115. X{}        Curly braces denote parts of the command which must appear, 
  116. X        but can take a number of different values. The differences 
  117. X        between Vim and Vi are also given in curly braces (this will 
  118. X        be clear from the context).
  119. X
  120. X{motion}    A command that moves the cursor. They are listed in chapter 
  121. X        6. This is used after an "operator" command to move over the 
  122. X        text that is to be operated upon. If the motion includes a 
  123. X        count and the operator also had a count, the two counts are 
  124. X        multiplied. For example: "2d3w" deletes six words.
  125. X
  126. X{visual}    A piece of text that is started with the "v", "V" or CTRL-V
  127. X        command and ended by the cursor position. This is used
  128. X        before an "operator" to highlight the text that is to be
  129. X        operated upon. See the chapter on Visual mode.
  130. X
  131. X<character>    A special character from the table below or a single ASCII
  132. X        character.
  133. X
  134. X<char1-char2>    A single character from the range <char1> to <char2>. For
  135. X        example: <a-z> is a lower case letter. Multiple ranges may be
  136. X        concatenated. For example: <a-zA-Z0-9> is any alphanumeric
  137. X        character.
  138. X
  139. XCTRL-<char>    <char> typed as a control character, that is, typing <char>
  140. X        while holding the CTRL key down. The case of <char> does not
  141. X        matter, thus CTRL-A and CTRL-a are equivalent.
  142. X
  143. X'option'    An option, or parameter, that can be set to a value is
  144. X        enclosed in single quotes. See chapter 19.
  145. X
  146. X"command"    In examples the commands you can type are enclosed in double
  147. X        quotes.
  148. X
  149. X
  150. Xnotation    meaning             equivalent decimal value
  151. X-----------------------------------------------------------------------
  152. X<NUL>        zero            CTRL_@  000 (internally 010)
  153. X<BELL>      bell            CTRL-G    007
  154. X<BS>        backspace        CTRL-H    008
  155. X<TAB>       tab            CTRL-I    009
  156. X<LF>        linefeed        CTRL-J    010
  157. X<FF>        formfeed        CTRL-L    012
  158. X<CR>        carriage return        CTRL-M    013
  159. X<ESC>       escape            CTRL-[    027
  160. X<SPACE>        space                032
  161. X<DEL>       delete                127
  162. X<C_UP>        cursor-up            128 (msdos: 176)
  163. X<C_DOWN>    cursor-down            129 (msdos: 177)
  164. X<C_LEFT>    cursor-left            130 (msdos: 178)
  165. X<C_RIGHT>    cursor-right            131 (msdos: 179)
  166. X<SC_UP>        shift-cursor-up            132 (msdos: 180)
  167. X<SC_DOWN>    shift-cursor-down        133 (msdos: 181)
  168. X<SC_LEFT>    shift-cursor-left        134 (msdos: 182)
  169. X<SC_RIGHT>    shift-cursor-right        135 (msdos: 183)
  170. X<F1> - <F10>    function keys 1 to 10        136 - 145 (msdos: 184 - 193)
  171. X<SF1> - <SF10>    shift-function keys 1 to 10    146 - 155 (msdos: 194 - 203)
  172. XHELP>        help key            156 (msdos: 204)
  173. X<UNDO>        undo key            157 (msdos: 205)
  174. X-----------------------------------------------------------------------
  175. XNote: The shifted cursor keys, the help key and the undo key are only
  176. Xavailable on a few terminals. On some terminals the function keys 11 to 20
  177. Xare used instead of the shifted function keys. On the Amiga shifted function
  178. Xkey 10 produces a code (CSI) that is also used by key sequences. It will be
  179. Xrecognized only after typing another key.
  180. X
  181. X
  182. X    3. Starting Vim
  183. X
  184. X3.1 Command line
  185. X
  186. XMost often Vim is started to edit a single file with the command
  187. X
  188. X    vim file
  189. X
  190. XMore generally Vim is started with:
  191. X
  192. X    vim [options] [filelist]
  193. X
  194. XIf the filelist is missing, the editor will start with an empty buffer.
  195. XOtherwise exactly one out of the following six may be used to choose one or
  196. Xmore files to be edited.
  197. X
  198. Xfile ..        A list of file names. The first one will be the current file 
  199. X        and read into the buffer. The cursor will be positioned on 
  200. X        the first line of the buffer.
  201. X
  202. X+[num] file ..    Same as the above, but the cursor will be positioned on line
  203. X        "num". If "num" is missing, the cursor will be positioned on
  204. X        the last line.
  205. X
  206. X+/{pat} file ..    Same as the above, but the cursor will be positioned on the
  207. X        first line containing "pat" in the current file (see the 
  208. X        section "pattern searches" for the available search 
  209. X        patterns).
  210. X
  211. X+{command} file ..
  212. X-c {command} file ..
  213. X        Same as the above, but "command" will be executed after the 
  214. X        file has been read. "command" is interpreted as an Ex 
  215. X        command. If the "command" contains spaces it must be 
  216. X        enclosed in double quotes (this depends on the shell that is 
  217. X        used). Example: vim "+set si" main.c
  218. X
  219. X-t {tag}    A tag. "tag" is looked up in the tags file, the associated 
  220. X        file becomes the current file and the associated command is 
  221. X        executed. Mostly this is used for C programs. In that case 
  222. X        "tag" should be a function name. The effect is that the file 
  223. X        containing that function becomes the current file and the 
  224. X        cursor is positioned on the start of the function (see the 
  225. X        section "tag searches").
  226. X
  227. X-e [errorfile]    QuickFix mode. The file with the name [errorfile] is read
  228. X        and the first error is displayed. If [errorfile] is not
  229. X        given, the 'errorfile' option is used for the file name
  230. X        (default "AztecC.Err" for the Amiga, "errors" for other
  231. X        systems). See section 5.5: "using the QuickFix mode".
  232. X
  233. XThe options, if present, must precede the filelist. The options may be given 
  234. Xin any order.
  235. X
  236. X-r        Recovery mode. The autoscript file is read to recover a 
  237. X        crashed editing session. It has almost the same effect as 
  238. X        "-s file.vim". See the chapter "Recovery after a crash".
  239. X
  240. X-v        View mode. The 'readonly' option will be set and no 
  241. X        autoscript file will be written (see -n below). You can 
  242. X        still edit the buffer, but will be prevented from 
  243. X        accidentally overwriting a file. If you forgot that you are 
  244. X        in View mode and did make some changes, you can overwrite 
  245. X        a file by adding an exclamation mark to the Ex command, as in 
  246. X        ":w!". The 'readonly' option can be reset with ":set noro" 
  247. X        (see the options chapter). Calling the executable "view" 
  248. X        has the same effect as the -v option. If your system does 
  249. X        not support links and you do not want to have the executable 
  250. X        twice you could make an alias: "alias view vim -v".
  251. X
  252. X-b        Binary mode. The 'textauto', 'textmode' and 'expandtab'
  253. X        options will be reset. The 'textwidth' option is set to 0.
  254. X        'modelines' is set to 0. The 'binary' option is set. This is
  255. X        done after reading the .vimrc/.exrc files but before reading
  256. X        a file. See also 5.6: "Editing binary files".
  257. X
  258. X-n        No autoscript file will be written. Recovery after a crash 
  259. X        will be impossible. Handy if you want to edit a file on a 
  260. X        very slow medium (e.g. floppy). Can also be done with ":set 
  261. X        uc=0". You can switch it on again by setting the 'uc' option 
  262. X        to some value, e.g. ":set uc=100" (only do this if the 
  263. X        buffer was not changed yet).
  264. X
  265. X-x        Do not restart Vim to open a new window. This option should 
  266. X        be used when Vim is started by a program that will wait for 
  267. X        the edit session to finish (e.g. mail or readnews). See 
  268. X        section 3.3.
  269. X
  270. X-T {terminal}    Set the terminal type to "terminal". This influences the 
  271. X        codes that Vim will send to your terminal. This is normally 
  272. X        not needed, because Vim will be able to find out what type 
  273. X        of terminal you are using (See chapter 20).
  274. X
  275. X-d {device}    The "device" is opened to be used for editing. Normally you 
  276. X        would use this to set the window position and size:
  277. X        "-d con:x/y/width/height", e.g. "-d con:30/10/600/150". But 
  278. X        you can also use it to start editing on another device, e.g. 
  279. X        AUX:. This only works on the Amiga.
  280. X
  281. X-s {scriptin}    The script file "scriptin" is read. The characters in the 
  282. X        file are interpreted as if you had typed them. The same can 
  283. X        be done with the command ":source! {scriptin}". If the end 
  284. X        of the file is reached before the editor exits, further 
  285. X        characters are read from the keyboard. See also the section 
  286. X        "complex repeats".
  287. X
  288. X-w {scriptout}    All the characters that you type are recorded in the file
  289. X        "scriptout", until you exit Vim. This is useful if you want 
  290. X        to create a script file to be used with "vim -s" or 
  291. X        ":source!". See also the section "complex repeats".
  292. X
  293. XExample for using a script file to change a name in several files:
  294. X    Create a file "subs.vi" containing substitute commands and a :wq
  295. X    command:
  296. X
  297. X        :%s/Jones/Smith/g
  298. X        :%s/Allen/Peter/g
  299. X        :wq
  300. X
  301. X    Execute Vim on all files you want to change:
  302. X
  303. X        foreach i ( *.let ) vim -s subs.vi $i
  304. X
  305. XIf the executable is called "view" Vim will start in Readonly mode. This is 
  306. Xuseful if you can make a hard or symbolic link from "view" to "vim".
  307. XStarting in Readonly mode can also be done with "vim -v". 
  308. X
  309. X
  310. X3.2 Workbench (Amiga only)
  311. X
  312. XVim can be started from the workbench by clicking on its icon twice. It will
  313. Xthen start with an empty buffer.
  314. X
  315. XVim can be started to edit one or more files by using a "Project" icon. The
  316. X"Default Tool" of the icon must be the full pathname of the Vim executable. 
  317. XThe name of the ".info" file must be the same as the name of the text file. 
  318. XBy clicking on this icon twice, Vim will be started with the filename as 
  319. Xcurrent filename, which will be read into the buffer (if it exists). You can 
  320. Xedit multiple files by pressing the shift key while clicking on icons, and 
  321. Xclicking twice on the last one. The "Default Tool" for all these icons must 
  322. Xbe the same.
  323. X
  324. XIt is not possible to give arguments to Vim, other than filenames, from the
  325. Xworkbench.
  326. X
  327. X
  328. X3.3 Vim window (Amiga only)
  329. X
  330. XVim will run in the CLI window where it was started. If Vim was started with 
  331. Xthe "run" or "runback" command, or if Vim was started from the workbench, it 
  332. Xwill open a window of its own.
  333. X
  334. XTechnical detail:
  335. X    To open the new window a little trick is used. As soon as Vim 
  336. X    recognizes that it does not run in a normal CLI window, it will 
  337. X    create a script file in t:. This script file contains the same 
  338. X    command as how Vim was started, and an "endcli" command. This script 
  339. X    file is then executed with a "newcli" command (the "c:run" and 
  340. X    "c:newcli" commands are required for this to work). The script file 
  341. X    will hang around until reboot, or until you delete it. This method 
  342. X    is required to get the ":sh" and ":!" commands to work correctly. 
  343. X    But when Vim was started with the -e option (Quickfix mode) or with 
  344. X    the -x option, this method is not used. The reason for this is that 
  345. X    when a compiler starts Vim with the -e option it will wait for a 
  346. X    return code. With the script trick the compiler cannot get the 
  347. X    return code. The -x option can be used when Vim is started by a mail 
  348. X    program which also waits for the edit session to finish. As a 
  349. X    consequence the ":sh" and ":!" commands are not available when the 
  350. X    -e or -x option is used.
  351. X
  352. XVim will automatically recognize the window size and react to window 
  353. Xresizing. Under Amiga DOS 1.3 it is advised to use the fastfonts program 
  354. X"FF" to speed up display redrawing.
  355. X
  356. X
  357. X3.4 Initialization
  358. X
  359. XWhen Vim starts running it does initializations in the following order. If
  360. Xan environment variable is used, it is executed as a single Ex command line.
  361. XMultiple commands must be separated with <|>. If a file is used, each line
  362. Xis executed as an Ex command line.
  363. X
  364. X1.  Four places are searched for initializations. The first that exists is 
  365. X    used, the others are ignored.
  366. X     1. The environment variable VIMINIT
  367. X     2. The file "s:.vimrc" (for Unix: "$HOME/.vimrc")
  368. X     3. The environment variable EXINIT
  369. X     4. The file "s:.exrc" (for Unix: "$HOME/.exrc")
  370. X
  371. X2.  If the 'exrc' option is set (default is 'noexrc'), the current directory
  372. X    is searched for two files. The first that exists is used, the other is
  373. X    ignored.
  374. X     1. The file ".vimrc"
  375. X     2. The file ".exrc"
  376. X
  377. X3.  The environment variable SHELL, if it exists, is used to set the 
  378. X    'shell' option. With MSDOS the COMPSPEC variable is used if SHELL does
  379. X    not exist.
  380. X
  381. X4.  The environment variable TERM, if it exists, is used to set the 'term'
  382. X    option.
  383. X
  384. XThe first can be used to set your default settings and mappings for all edit 
  385. Xsessions. The second one for sessions in a certain directory (note that the
  386. X'exrc' option is default off). See the section "Saving settings" for how to
  387. Xcreate a file with commands to recreate the current settings.
  388. X
  389. XIf the VIMINIT environment variable or ".vimrc" exist the EXINIT and ".exrc" 
  390. Xare skipped. This can be used to initialize Vim without interfering with 
  391. Xanother version of Vi.
  392. X
  393. XOn the Amiga two types of environment variables exist. The ones set with the
  394. XDOS 1.3 (or later) setenv command are recognized. See the AmigaDos 1.3 
  395. Xmanual. The environment variables set with the old Manx Set command (before 
  396. Xversion 5.0) are not recognized.
  397. X
  398. XOn MS-DOS systems Vim assumes that all the "_vimrc" and "_exrc" files have
  399. X<CR><LF> pairs as line separators. This will give problems if you have a
  400. Xfile with only <LF>s and have a line like ":map xx yy^M". The trailing ^M
  401. Xwill be ignored.
  402. X
  403. XWhile reading the ".vimrc" or the ".exrc" file in the current directory some
  404. Xcommands can be disabled for security reasons by setting the 'secure'
  405. Xoption. Otherwise it would be possible to create a .exrc that contains nasty
  406. Xcommands, which another user may automatically execute when he starts Vim it
  407. Xthat directory. The disabled commands are the ones that start a shell and
  408. Xthe ones that write to a file. The ":map" commands are echoed, so you can
  409. Xsee which keys are being mapped.
  410. X
  411. XYou can reset the 'secure' option in the EXINIT or VIMINIT environment
  412. Xvariable or in the global ".exrc" or ".vimrc" file. This is not possible in
  413. X".vimrc" or ".exrc" in the current directory, for obvious reasons.
  414. X
  415. XOn unix systems this only happens if you are not the owner of the ".vimrc" 
  416. Xor ".exrc" file. Warning: If you unpack an archive that contains a .exrc 
  417. Xfile, it will be owned by you. You won't have the security protection. Check 
  418. Xthe .exrc file before you start Vim in that directory, or reset the 'exrc' 
  419. Xoption. 
  420. X
  421. X
  422. X3.5 Suspending
  423. X
  424. XCTRL-Z                Suspend the editor. Same as ":stop".
  425. X
  426. X:sus[pend][!]        or
  427. X:st[op][!]            Suspend the editor. If the <!> is not given,
  428. X                the buffer was changed, autowrite is set and 
  429. X                a filename is known, the buffer will be 
  430. X                written.
  431. X
  432. XOn many UNIX systems it is possible to suspend Vim with CTRL-Z. This is only 
  433. Xpossible in Command mode (see next chapter). Vim will continue if you make it 
  434. Xthe foreground job again. On other systems CTRL-Z will start a new shell. 
  435. XThis is the same as the ":sh" command. Vim will continue if you exit from the 
  436. Xshell.
  437. X
  438. X
  439. X    4. Modes
  440. X
  441. X4.1 Introduction
  442. X
  443. XVim has four basic modes:
  444. X
  445. XCommand mode        In Command mode you can enter all the editor
  446. X            commands. If you start the editor you are in this 
  447. X            mode (unless you have set the 'insertmode' option, 
  448. X            see below).
  449. X
  450. XInsert mode        In Insert mode the text you type is inserted into the
  451. X            buffer. If the 'showmode' option is set (which is
  452. X            default), the string "-- INSERT --" is shown at the
  453. X            bottom of the window.
  454. X
  455. XReplace mode        Replace mode is a special case of Insert mode. You
  456. X            can do the same things as in Insert mode, but for 
  457. X            each character you enter (except some special 
  458. X            characters) one character of the existing text is 
  459. X            deleted. If the 'showmode' option is set (which is 
  460. X            default), the string "-- REPLACE --" is shown at the 
  461. X            bottom of the window.
  462. X
  463. XCommand_line mode    In Command_line mode you can enter one line of text
  464. X            at the bottom of the window. This is for the Ex
  465. X            commands <:>, the pattern search commands <?></> and
  466. X            the filter command <!>.
  467. X
  468. XMore explanation on the insert, replace and Command_line mode is further on 
  469. Xin this chapter.
  470. X
  471. X
  472. X4.2 Switching from mode to mode
  473. X
  474. XIf for any reason you do not know in which mode you are, you can always get
  475. Xback to Command mode by typing <ESC> twice. You will know you are back in
  476. XCommand mode when you see the screen flash or hear the bell after you type
  477. X<ESC>.
  478. X
  479. X- go from Command mode to Insert mode by giving one of the commands
  480. X  "iIaAoOcCsS".
  481. X- go from Command mode to Replace mode with the "R" command (not the "r"
  482. X  command!).
  483. X- go from Command mode to Command_line mode with the one of the commands
  484. X  ":/?!".
  485. X
  486. X- go from insert or Replace mode to Command mode with <ESC> (twice in some
  487. X  rare cases).
  488. X- go from Command_line mode to Command mode by:
  489. X   - hitting <CR> or <LF>, which causes the entered command to be executed
  490. X   - deleting the complete line (e.g. with CTRL-U) and giving a final <BS>
  491. X   - hitting CTRL-C or <ESC>, which quits the command line without executing
  492. X     the command.
  493. X  In the last case <ESC> may be the character defined with the 'wildchar'
  494. X  option, and start filename completion. You can ignore that and type <ESC>
  495. X  again. {vi: when hitting <ESC> the command line is executed. This is
  496. X  unexpected for most people, therefore it was changed in Vim. But when the
  497. X  <ESC> is part of a mapping the command line is executed. If you want the
  498. X  vi behaviour also when typing <ESC> use ":cmap ^V<ESC> ^V^M"}
  499. X
  500. XIf the 'insertmode' option is set, editing a file will start in Insert mode.
  501. X
  502. X
  503. X4.3 Insert and Replace mode
  504. X
  505. XIn insert and Replace mode the following characters have a special meaning,
  506. Xother characters are inserted directly. To insert one of these special
  507. Xcharacters into the buffer, precede it with CTRL-V. To insert a <NUL> 
  508. Xcharacter use "CTRL-V CTRL-@" or "CTRL-V 000". On some systems you have to
  509. Xuse "CTRL-V 003" to insert a CTRL-C.
  510. X
  511. Xchar        action
  512. X-----------------------------------------------------------------------
  513. XCTRL-@        Insert previously inserted text and stop insert. {Vi: only
  514. X        when typed as first char, only up to 128 chars}
  515. XCTRL-A        Insert previously inserted text. {not in Vi}
  516. XCTRL-C        Quit insert mode, back to command mode.
  517. XCTRL-D        Delete one shiftwidth of indent at the start of the current 
  518. X        line. See also 'shiftround' option. When preceded with <^>
  519. X        or <0> delete all indent in the current line. With <^> the
  520. X        indent is restored in the next line. This is useful when
  521. X        inserting a label. {Vi: CTRL-D works only when used after
  522. X        autoindent}
  523. XCTRL-E        Insert the character which is below the cursor. {not in Vi}
  524. XCTRL-H <BS>    Delete the character before the cursor (see below). {Vi: 
  525. X        does not delete autoindents}
  526. XCTRL-I <TAB>    Insert a tab. If the 'expandtab' option is on, the
  527. X        equivalent number of spaces is inserted (use CTRL-V <TAB> to
  528. X        avoid the expansion).
  529. XCTRL-J <LF>    Begin new line.
  530. XCTRL-K {char1} {char2}
  531. X        Enter digraph (see 4.7). {not in Vi}
  532. XCTRL-M <CR>    Begin new line.
  533. XCTRL-O        Execute one Command mode command. See below. {not in Vi}
  534. XCTRL-P        Toggle the 'revins' option. {not in Vi}
  535. XCTRL-R <0-9a-z"%>
  536. X        Insert the contents of a numbered or named register. The
  537. X        text is inserted as if you typed it, but mappings and
  538. X        abbreviations are not used. If you have options like
  539. X        'textwidht' or 'autoindent' set, this will influence what
  540. X        will be inserted. Use <"> for the unnamed register,
  541. X        containing the text of the last delete or yank. Use <%> for
  542. X        the current file name.  See the chapter on copying and
  543. X        moving text about registers. {not in Vi}
  544. XCTRL-T        Insert one shiftwidth of indent at the start of the current 
  545. X        line. See also 'shiftround' option. {Vi: only when in 
  546. X        autoindent}
  547. XCTRL-U        Delete all entered characters in the current line (see 
  548. X        below).
  549. XCTRL-V        Insert next non-digit literally. Up to three digits form the 
  550. X        decimal value of a single byte. The non-digit and the three
  551. X        digits are not considered for mapping. {Vi: no decimal byte
  552. X        entry}
  553. XCTRL-W        Delete the word before the cursor (see below). See the 
  554. X        section "word motions" for the definition of a word.
  555. XCTRL-Y        Insert the character which is above the cursor. {not in Vi}
  556. XCTRL-[ or <ESC>    End insert or Replace mode, back to Command mode.
  557. X<DEL>        Same as CTRL-H <BS>
  558. X-----------------------------------------------------------------------
  559. X
  560. XThe effect of the <BS>, <DEL>, CTRL-W and CTRL-U depends on the 'backspace' 
  561. Xoption (unless 'revins' is set):
  562. X
  563. Xbackspace    action
  564. X option
  565. X   0       delete stops in column 1 and start position of insert
  566. X   1       delete stops at start position of insert
  567. X   2       delete always, CTRL-W and CTRL-U stop once at start position of 
  568. X          insert
  569. X
  570. XIf the 'backspace' option is non-zero and the cursor is in column 1 when one 
  571. Xof the three keys is used, the current line is joined with the previous 
  572. Xline. This effectively deletes the newline in front of the cursor. {Vi: does 
  573. Xnot cross lines, does not delete past start position of insert}
  574. X
  575. XWith CTRL-V followed by one, two or three digits you can enter the decimal 
  576. Xvalue of a byte, except 10. Normally CTRL-V is followed by three digits. The 
  577. Xformed byte is inserted as soon as you type the third digit. If you type 
  578. Xonly one or two digits and then a non-digit, the decimal value of those one 
  579. Xor two digits form the byte. After that the non-digit is dealt with in the 
  580. Xnormal way. If you enter a value of 10, it will end up in the file as a 0.
  581. XThe 10 is a <LF>, which is used internally to represent the <NUL> character.
  582. XWhen writing the buffer to a file the <LF> character is translated into
  583. X<NUL>. The <LF> character is written at the end of each line. Thus if you
  584. Xwant to insert a <LF> character in a file you will have to make a line
  585. Xbreak.
  586. X
  587. X
  588. Xspecial keys
  589. X
  590. XThe following keys are special. They stop the current insert, do something 
  591. Xand then restart insertion. This means you can do something without getting 
  592. Xout of Insert mode. This is very handy if you prefer to use the Insert mode 
  593. Xall the time, just like editors that don't have a separate Command mode. You 
  594. Xmay also want to set the 'backspace' option to 2 and set the 'insertmode' 
  595. Xoption. You can use CTRL-O if you want to map a function key to a command.
  596. X
  597. XThe changes (inserted or deleted characters) before and after these keys can 
  598. Xbe undone separately. Only the last change can be redone and always behaves 
  599. Xlike an "i" command.
  600. X
  601. Xchar        action
  602. X-----------------------------------------------------------------------
  603. X<C_UP>        cursor one line up
  604. X<C_DOWN>    cursor one line down
  605. X<C_LEFT>    cursor one character left
  606. X<C_RIGHT>    cursor one character right
  607. X<SC_UP>        move window one page up
  608. X<SC_DOWN>    move window one page down
  609. X<SC_LEFT>    cursor one word back (like "b" command)
  610. X<SC_RIGHT>    cursor one word forward (like "w" command)
  611. XCTRL-O        execute one command and return to Insert mode
  612. X-----------------------------------------------------------------------
  613. X
  614. XThe CTRL-O command has one side effect: If the cursor was beyond the end of 
  615. Xthe line it will be put on the last character in the line.
  616. XThe shifted cursor keys are not available on all terminals.
  617. X
  618. X
  619. X'textwidth' option
  620. X
  621. XThe 'textwidth' option can be used to automatically break a line before it 
  622. Xgets too long. Set the 'textwidth' option to the desired maximum line 
  623. Xlength. If you then type more characters (not spaces or tabs), the 
  624. Xlast word will be put on a new line (unless it is the only word on the 
  625. Xline). If you set 'textwidth' to 0, this feature is disabled. Vi has the
  626. X'wrapmargin' option, but it does not do what you want. For compatibility, if
  627. Xyou set the 'wrapmargin' option, 'textwidth' will be set to (columns -
  628. X'wrapmargin'), where columns is the width of the display.
  629. X
  630. XIf you want to format a block of text you can use the "Q" operator. Type "Q" 
  631. Xand a movement command to move the cursor to the end of the block. In many 
  632. Xcases the command "Q}" will do what you want (format until the end of 
  633. Xparagraph). Or you can use visual mode: hit "v", move to the end of the
  634. Xblock and hit "Q".
  635. X
  636. X
  637. X'expandtab' option
  638. X
  639. XIf the 'expandtab' option is set, spaces will be used to fill the amount of
  640. Xwhitespace of the tab. If you want to enter a real <TAB> type CTRL-V first.
  641. XThe 'expandtab' option is default off. Note that in Replace mode a single
  642. Xcharacter is replaced by several spaces. The result of this is that the
  643. Xnumber of characters in the line increases. Backspacing will delete one
  644. Xspace at a time. The original text will be put back in a place where you
  645. Xwould not expect it.
  646. X
  647. X
  648. Xtyping backwards
  649. X
  650. XIf the 'revins' (reverse insert) option is set, inserting happens backwards.
  651. XThis can be used to type Hebrew. When inserting characters the cursor is not
  652. Xmoved and the text moves rightwards. A <BS> deletes the character under the
  653. Xcursor. CTRL-W and CTRL-U also work in the opposite direction. <BS>, CTRL-W
  654. Xand CTRL-U do not stop at the start of insert or end of line, no matter how
  655. Xthe 'backspace' option is set.
  656. X
  657. XIn Replace mode the cursor is moved leftwards. <BS> will restore the
  658. Xcharacter right of the cursor.
  659. X
  660. XIn insert or Replace mode the 'revins' option can be toggled with CTRL-P.
  661. X
  662. XIf the 'showmode' option is set, "-- REVERSE INSERT --" or
  663. X"-- REVERSE REPLACE --" will be shown in the status line.
  664. X
  665. X
  666. XReplace mode
  667. X
  668. XIn Replace mode one character in the line is deleted for every character you 
  669. Xtype. If there is no character to delete (at the end of the line), the 
  670. Xtyped character is appended (as in Insert mode). Thus the number of 
  671. Xcharacters in a line stays the same until you get to the end of the line.
  672. X
  673. XBe careful with <TAB> characters. If you type a normal printing character in 
  674. Xits place, the number of characters is still the same, but the number of 
  675. Xcolumns will become smaller.
  676. X
  677. XIf you delete characters in Replace mode (with <BS>, <DEL>, CTRL-W or
  678. XCTRL-U), you really delete your changes. The characters that were replaced
  679. Xare restored. If you had typed past the existing text, the characters you
  680. Xadded are deleted.
  681. X    All this only works in the current line. If you have started a new line
  682. X(replaced a character with a <CR>) Vim no longer remembers what happened in
  683. Xthe previous line. If you backspace over the newline (only possible if the
  684. X'backspace' option is non-zero), the two lines will be joined again, but
  685. Xtyping further backspaces will not restore the original text. Only the
  686. Xcursor is moved.
  687. X    If the 'expandtab' option is set, a <TAB> will replace one character
  688. Xwith several spaces. When backspacing over these spaces, the original text
  689. Xwill appear in a position where you would not expect it.
  690. X
  691. X
  692. X4.4 Command_line mode
  693. X
  694. XCommand_line mode is used to enter Ex commands <:>, search patterns </><?>
  695. Xand filter commands <!>.
  696. X
  697. X
  698. X4.4.1 Command line editing
  699. X
  700. XNormal characters are inserted in front of the cursor position. You can move
  701. Xaround in the command line with the left and right cursor keys. {Vi: can 
  702. Xonly alter the last character in the line}
  703. X
  704. XThe command lines that you enter are remembered in a history table. You can
  705. Xrecall them with the up and down cursor keys. Use the 'history' option to 
  706. Xset the number of lines that are remembered (default 20).
  707. X
  708. XCTRL-V        Insert next non-digit literally. Up to three digits form the 
  709. X        decimal value of a single byte. The non-digit and the three
  710. X        digits are not considered for mapping. This works the same
  711. X        way as in Insert mode (see above).
  712. X<C_LEFT>    cursor left
  713. X<C_RIGHT>    cursor right
  714. X<SC_LEFT>    cursor one word left
  715. X<SC_RIGHT>    cursor one word right
  716. XCTRL-B        cursor to begin of command line
  717. XCTRL-E        cursor to end of command line
  718. X
  719. X<BS>        delete the character in front of the cursor
  720. X<DEL>        delete the character under the cursor (at end of line:
  721. X        character in front of the cursor)
  722. XCTRL-W        delete the word in front of the cursor
  723. XCTRL-U        remove all characters
  724. X
  725. X        Note: if the command line becomes empty with one of the
  726. X        delete commands, command line mode is quit.
  727. X
  728. X{char1} <BS> {char2}    or
  729. XCTRL-K {char1} {char2}
  730. X        enter digraph (see 4.7). {not in Vi}
  731. X
  732. X<CR> or <LF>    start entered command
  733. X<ESC>        when typed: quit command line without executing
  734. X        in macros: start entered command
  735. XCTRL-C        quit command line without executing
  736. X
  737. X<C_UP>        recall older command line from history
  738. X<C_DOWN>    recall more recent command line from history
  739. X
  740. X<SC_UP>        recall older command line from history, which begin matches 
  741. X        the current command line.
  742. X<SC_DOWN>    recall more recent command line from history, which begin 
  743. X        matches the current command line.
  744. X
  745. XCTRL-D        list filenames that match the pattern in front of the cursor
  746. X'wildchar' option
  747. X        do filename completion on the pattern in front of the cursor
  748. X        (Note: does not work inside a macro)
  749. XCTRL-K {char1} {char2}
  750. X        enter digraph (see 4.7). {not in Vi}
  751. XCTRL-N        after 'wildchar' with multiple matches: go to next match;
  752. X        otherwise: recall more recent command line from history
  753. XCTRL-P        after 'wildchar' with multiple matches: go to previous match;
  754. X        otherwise: recall older command line from history
  755. XCTRL-A        do filename completion on the pattern in front of the cursor
  756. X        and insert all matches
  757. XCTRL-L        do filename completion on the pattern in front of the cursor
  758. X        and insert the longest common part
  759. X
  760. XThe 'wildchar' option defaults to <TAB> (CTRL-E when compiled with 
  761. XCOMPATIBLE; in a previous version <ESC> was used). In the pattern for 
  762. XCTRL-D and 'wildchar' standard Amiga wildcards are accepted, plus the <*> 
  763. Xand <?> characters.
  764. X
  765. XFor filename completion you can use the 'suffixes' option to set a priority 
  766. Xbetween files with almost the same name. If there are multiple matches, 
  767. Xthose files with an extension that is in the 'suffixes' option are ignored.
  768. XThe default is ".bak.o.h.info.vim", which means that files with the
  769. Xextensions ".bak", ".o", ".h", ".info" and ".vim" are sometimes ignored. It
  770. Xis impossible to ignore suffixes with two dots. Examples:
  771. X
  772. Xpattern:    files:                match:
  773. Xtest*        test.c test.h test.o        test.c
  774. Xtest*        test.h test.o            test.h and test.o
  775. Xtest*        test.i test.h test.c        test.i and test.c
  776. X
  777. XIf there is more than one matching file (after ignoring the ones matching
  778. Xthe 'suffixes' option) the message "Too many file names" is given. The first
  779. Xfile name is inserted. You can get to the others by entering 'wildchar',
  780. XCTRL-N or CTRL-P. All files are included then, also the ones with extensions
  781. Xmatching the 'suffixes' option.
  782. X
  783. XThe <SC_UP> and <SC_DOWN> keys take the current command line as search 
  784. Xstring. The beginning of the next/previous command lines are compared against 
  785. Xthis string. The fist line that matches is the new command line. When typing 
  786. Xthese two keys repeatedly, the same string is used again. For example this 
  787. Xcan be used to find the previous substitute command: Type ":s" and then 
  788. X<SC_UP>. The same could be done by typing <C_UP> a number of times until the 
  789. Xdesired command line is shown. (Note: the shifted arrow keys do not work on
  790. Xall terminals) 
  791. X
  792. X
  793. X4.4.2 Ex command lines
  794. X
  795. XThe Ex commands have a few specialities:
  796. X
  797. X<"> or <#> at the start of a line causes the whole line to be ignored. <"> 
  798. Xafter a command causes the rest of the line to be ignored. This can be used 
  799. Xto add comments.
  800. X
  801. X<|> can be used to separate commands, so you can give multiple commands in 
  802. Xone line. The commands ":global", "vglobal" and  ":!" see the <|> as their
  803. Xargument, and can therefore not be followed by another command. If you want
  804. X<|> to be included in a command, precede it with <\>. Note that this is
  805. Xconfusing (inherited from vi). If you give a command with ":!" you don't
  806. Xhave to use a backslash, with ":r !" you have to. And with ":g" the <|> is
  807. Xincluded in the command, with ":s" it is not. Examples:
  808. X    :!ls | wc        view the output of two commands
  809. X    :r !ls \| wc        insert the same output in the text
  810. X    :%g/foo/p|>        moves all matching lines one shiftwidth
  811. X    :%s/foo/bar/|>        moves one line one shiftwidth
  812. X
  813. XWhen the character <%> or <#> is used where a filename is expected, they are 
  814. Xexpanded to the current and alternate filename (see the chapter "editing 
  815. Xfiles").
  816. X
  817. XEmbedded spaces in filenames are allowed if one filename is expected as
  818. Xargument. Trailing spaces will be ignored, unless escaped with a backslash
  819. Xor CTRL-V. Note that the ":next" command uses spaces to separate file names.
  820. XEscape the spaces to include them in a file name. Example:
  821. X    :next foo\ bar goes\ to school\ 
  822. Xstarts editing the three files "foo bar", "goes to" and "school ".
  823. X
  824. XWhen you want to use the special characters <"> or  <|> in a command, or want
  825. Xto use <%> or <#> in a filename, precede them with a backslash. The backslash
  826. Xis not required in a range and in the ":substitute" command.
  827. X
  828. X
  829. X4.4.3 Ex command line ranges
  830. X
  831. XSome Ex commands accept a line range in front of them. This is noted as
  832. X[range]. It consists of one or more line specifiers, separated with <,> or 
  833. X<;>. When separated with <;> the cursor position will be set to that line 
  834. Xbefore interpreting the next line specifier. The default line specifier for 
  835. Xmost commands is the cursor position, but the commands ":write" and 
  836. X":global" have the whole file (1,$) as default. If more line specifiers are 
  837. Xgiven than required for the command, the first one(s) will be ignored.
  838. X
  839. XLine numbers may be specified with:
  840. X    {number}    an absolute line number
  841. X    .        the current line
  842. X    $        the last line in the file
  843. X    %        equal to 1,$ (the entire file)
  844. X    't        position of mark t (lower case)
  845. X    /{pattern}[/]    the next line where {pattern} matches
  846. X    ?{pattern}[?]    the previous line where {pattern} matches
  847. X
  848. XEach may be followed (several times) by <+> or <-> and an optional number. 
  849. XThis number is added or subtracted from the preceding line number. If the 
  850. Xnumber is omitted, 1 is used.
  851. X
  852. XThe "/" and "?" may be preceded with another address. The search starts from
  853. Xthere. The "/" and "?" after {pattern} are required to separate the pattern
  854. Xfrom anything that follows.
  855. X
  856. XThe {number} must be between 0 and the number of lines in the file. A 0 is 
  857. Xinterpreted as a 1, except with the commands tag, pop and read.
  858. X
  859. XExamples:
  860. X    .+3        three lines below the cursor
  861. X    /that/+1    the line below the next line containing "that"
  862. X    .,$        from current line until end of file
  863. X    0/that        the first line containing "that"
  864. X
  865. XSome commands allow for a count after the command. This count is used as the
  866. Xnumber of lines to be used, starting with the line given in the last line
  867. Xspecifier (the default is the cursor line).
  868. X
  869. XExamples:
  870. X    :s/x/X/g 5    substitute <x> by <X> in the current line and four
  871. X            following lines
  872. X    :23d 4        delete lines 23, 24, 25 and 26
  873. X
  874. X
  875. X4.5 The window contents
  876. X
  877. XIn command and Insert/Replace mode the screen window will show the current
  878. Xcontents of the buffer: What You See Is What You Get. {Vi: when changing 
  879. Xtext a <$> is placed on the last changed character; The window is not always 
  880. Xupdated on slow terminals} Lines longer than the window width will wrap,
  881. Xunless the 'wrap' option is off (see below). The bottom lines in the window
  882. Xmay start with one of these two characters:
  883. X
  884. X<@>     The next line is too long to fit in the window.
  885. X<~>    Below the last line in the buffer.
  886. X
  887. XIf the bottom line is completely filled with <@>, the line that is at the 
  888. Xtop of the window is too long to fit in the window. If the cursor is on this 
  889. Xline you can't see what you are doing, because this part of the line is not 
  890. Xshown. However, the part of the line before the <@>s can be edited normally. 
  891. X{Vi: gives an "internal error" on lines that do not fit in the window}
  892. X
  893. XIf the 'wrap' option is off, long lines will not wrap. Only the part that
  894. Xfits on the screen is shown. If the cursor is moved to a part of the line
  895. Xthat is not shown, the screen is scrolled horizontally. The advantage of
  896. Xthis method is that columns are shown as they are and lines that cannot fit
  897. Xon the screen can be edited. The disadvantage is that you cannot see all the
  898. Xcharacters of a line at once. The 'sidescroll' option can be set to the
  899. Xminimal number of columns to scroll. {Vi: has no 'wrap' option}
  900. X
  901. XAll normal ASCII characters are displayed directly on the screen. The <TAB> 
  902. Xis replaced by the number of spaces that it represents. Other non-printing 
  903. Xcharacters are replaced by "^<char>", where <char> is the non-printing 
  904. Xcharacter with 64 added. Thus character 7 (bell) will be shown as "^G". 
  905. XCharacters between 127 and 160 are replaced by "~<char>", where <char> is 
  906. Xthe character with 64 subtracted. These characters occupy more than one 
  907. Xposition on the screen. The cursor can only be positioned on the first one.
  908. X
  909. XIf you set the 'number' option, all lines will be preceded with their 
  910. Xnumber.
  911. X
  912. XIf you set the 'list' option, <TAB> characters will not be shown as several
  913. Xspaces, but as "^I". A <$> will be placed at the end of the line, so you can
  914. Xfind trailing blanks.
  915. X
  916. XIn Command_line mode only the command line itself is shown correctly. The
  917. Xdisplay of the buffer contents is updated as soon as you go back to Command
  918. Xmode.
  919. X
  920. XSome commands hand over the window to external commands (e.g. ":shell" and
  921. X"="). After these commands are finished the window may be clobbered with 
  922. Xoutput from the external command, so it needs to be redrawn. This is also 
  923. Xthe case if something is displayed on the status line that is longer than 
  924. Xthe width of the window. If you are expected to have a look at the screen 
  925. Xbefore it is redrawn, you get this message:
  926. X
  927. X        Press RETURN or enter command to continue
  928. X
  929. XAfter you type a key the screen will be redrawn and Vim continues. If you 
  930. Xtype <CR>, <SP> or <LF> nothing else happens. If you type any other key, it 
  931. Xwill be interpreted as (the start of) a new command. {Vi: only <:> commands 
  932. Xare interpreted}
  933. X
  934. XThe last line of the window is used for status and other messages. The 
  935. Xstatus messages will only be used if an option is on:
  936. X
  937. Xstatus message            option        default    unix default
  938. Xcurrent mode             'showmode'    on        on
  939. Xcommand characters        'showcmd'    on        off
  940. Xcursor position            'ruler'        off        off
  941. X
  942. XThe current mode is "-- INSERT --" or "-- REPLACE --". The command 
  943. Xcharacters are those that you typed but were not used yet. {Vi: does not
  944. Xshow the characters you typed or the cursor position}
  945. X
  946. XIf you have a slow terminal you can switch off the status messages to speed 
  947. Xup editing:
  948. X    :set nosc noru nosm
  949. X
  950. XIf there is an error, an error message will be shown for at least one second 
  951. X(in reverse video). {Vi: error messages may be overwritten with other 
  952. Xmessages before you have a chance to read them}
  953. X
  954. XSome commands show how many lines were affected. Above which threshold this
  955. Xhappens can be controlled with the 'report' option (default 2).
  956. X
  957. XOn the Amiga Vim will run in a CLI window. The name Vim and the full name of
  958. Xthe current filename will be shown in the title bar. When the window is
  959. Xresized, Vim will automatically redraw the window. You may make the window as
  960. Xsmall as you like, but if it gets too small not a single line will fit in it.
  961. XMake it at least 40 characters wide to be able to read most messages on the
  962. Xlast line.
  963. X
  964. XOn most Unix systems window resize works ok.  {Vi: not ok}
  965. X
  966. X
  967. X4.6 Abbreviations
  968. X
  969. XAbbreviations are used in insert mode, Replace mode and Command_line mode.
  970. XIf you enter a word that is an abbreviation, it is replaced by the word it
  971. Xstands for. Only whole words are recognized. A word is made up of letters,
  972. Xdigits and <_>. You have to type a character other than a letter, digit, or
  973. X<_> in front of the word and after the word before the abbreviation is
  974. Xrecognized. The word may also begin at the start of a line and at the
  975. Xposition where the insertion started. You may also type a <CR> or <LF> after
  976. Xthe word.
  977. X
  978. XExample: ":ab foo four old otters". Note that spaces in the <rhs> are
  979. Xallowed and included in the replacement string. If you now insert the word
  980. X"foo" with a space before and after it, it will be replaced by "four old
  981. Xotters". If you would type "foobar" or "barfoo" nothing happens.
  982. X
  983. XTo avoid the abbreviation in insert mode type part of the abbreviation, exit
  984. Xinsert mode with <ESC>, re-enter insert mode with "a" and type the rest. In
  985. XCommand_line mode you can type CTRL-V twice somewhere in the abbreviation to
  986. Xavoid it to be replaced. A CTRL-V in front of a normal character is mostly
  987. Xignored otherwise.
  988. X
  989. XThere are no default abbreviations.
  990. X
  991. XAbbreviations are disabled if the 'paste' option is set.
  992. X
  993. X:ab[breviate]        list all abbreviations. The character in the first
  994. X            column indicates the mode where the abbreviation is
  995. X            used: 'i' for insert mode, 'c' for Command_line
  996. X            mode, '!' for both.
  997. X
  998. X:ab[breviate] <lhs>    list the abbreviations that start with <lhs>
  999. X
  1000. X:ab[breviate] <lhs> <rhs>
  1001. X            add abbreviation for <lhs> to <rhs>. If <lhs> already
  1002. X            existed it is replaced with the new <rhs>. <rhs> may
  1003. X            contain spaces.
  1004. X
  1005. X:una[bbreviate] <lhs>    remove abbreviation for <lhs> from the list
  1006. X
  1007. X:norea[bbrev] [lhs] [rhs]
  1008. X            same as ":ab", but no remapping for this <rhs> {not
  1009. X            in Vi}
  1010. X
  1011. X:ca[bbrev] [lhs] [rhs]    same as ":ab", but for Command_line mode only. {not
  1012. X            in Vi}
  1013. X
  1014. X:cuna[bbrev] <lhs>    same as ":una", but for Command_line mode only. {not
  1015. X            in Vi}
  1016. X
  1017. X:cnorea[bbrev] [lhs] [rhs]
  1018. X            same as ":ab", but for Command_line mode only and no
  1019. X            remapping for this <rhs> {not in Vi}
  1020. X
  1021. X:ia[bbrev] [lhs] [rhs]    same as ":ab", but for insert mode only. {not in Vi}
  1022. X
  1023. X:iuna[bbrev] <lhs>    same as ":una", but for insert mode only. {not in
  1024. X            Vi}
  1025. X
  1026. X:inorea[bbrev] [lhs] [rhs]
  1027. X            same as ":ab", but for insert mode only and no
  1028. X            remapping for this <rhs> {not in Vi}
  1029. X
  1030. X
  1031. X4.7 Digraphs
  1032. X
  1033. X:dig[raphs]        show currently defined digraphs. {not in Vi}
  1034. X
  1035. X:dig[raphs] {char1}{char2} {number} ...
  1036. X            Add digraph {char1}{char2} to the list. {number} is 
  1037. X            the decimal representation of the character.
  1038. X
  1039. XDigraphs are used to enter characters that normally cannot be entered by 
  1040. Xan ordinary keyboard. These are mostly accented characters which have the 
  1041. Xeighth bit set. The digraphs are easier to remember than the decimal number
  1042. Xthat can be entered with CTRL-V (see above).
  1043. X
  1044. XVim must have been compiled with the 'digraphs' option enabled. If not, the 
  1045. X":digraph" command will display an error message.
  1046. X
  1047. XThere are two methods to enter digraphs:
  1048. X    CTRL-K {char1} {char2}        or
  1049. X    {char1} <BS> {char2}
  1050. XThe first is always available. The second only when the 'digraph' option is 
  1051. Xset.
  1052. X
  1053. XOnce you have entered the digraph the character is treated like a normal 
  1054. Xcharacter, taking up only one character in the file and on the screen. 
  1055. XExample:
  1056. X    <|> <BS> <|>    will enter the double <|> character (166)
  1057. X    <a> <BS> <^>    will enter an <a> with a hat (226)
  1058. X    CTRL-K <-> <->    will enter a minus sign (173)
  1059. X
  1060. XThe default digraphs are listed in the file digraph.doc. They are meant for 
  1061. Xthe Amiga character set, which is some international standard. With another 
  1062. Xcharacter set they may be illogical.
  1063. X
  1064. XIf you accidently typed an <a> that should be an <e>, you will type <a> <BS> 
  1065. X<e>. But that is a digraph, so you will not get what you want. To avoid this, 
  1066. Xuse <DEL> instead of <BS>.
  1067. X
  1068. X
  1069. X    5. Editing files
  1070. X
  1071. X5.1 Introduction
  1072. X
  1073. XEditing a file with Vim means:
  1074. X
  1075. X1. reading the file into the internal buffer
  1076. X2. changing the buffer with editor commands
  1077. X3. writing the buffer into a file
  1078. X
  1079. XAs long as you don't write the buffer, the original file remains unchanged. 
  1080. XIf you start editing a file (read a file into the buffer), the file name is 
  1081. Xremembered as the "current filename".
  1082. X
  1083. XIf there already was a current filename, then that one becomes the alternate 
  1084. Xfile name. Up to 20 older alternate filenames are remembered in a list. When 
  1085. Xyou enter a filename, for editing (e.g. with ":e filename") or writing (e.g. 
  1086. Xwith (:w filename"), the filenames shift one down in this list. You can use 
  1087. Xthis list to remember which files you edited and to quickly switch from one 
  1088. Xfile to another with the CTRL-^ command (e.g. to copy text). {Vi: only one 
  1089. Xalternate filename}
  1090. X
  1091. XIn Ex commands (the ones that start with a colon) <%> is replaced by the
  1092. Xcurrent filename and <#> is replaced by the alternate filename. The older
  1093. Xalternate filenames are "#1", "#2", ..., "#9". "#0" is the same as "#". "#<"
  1094. Xis replaced by the current filename with the extension deleted (everything
  1095. Xafter and including the last '.' in the file name).
  1096. X
  1097. XCTRL-G        or
  1098. X:f[ile]            Prints the current filename (as typed) and the
  1099. X            cursor position.
  1100. X
  1101. X{count}CTRL-G        Prints the current filename with full path and the
  1102. X            cursor position.
  1103. X
  1104. X:f[ile] {name}        Sets the current filename to {name}.
  1105. X
  1106. X:files            Lists the alternate filenames.
  1107. X
  1108. XVim will remember the full path name of a file name that you enter. In most
  1109. Xcases when the file name is displayed only the name you typed is shown, but
  1110. Xthe full path name is being used if you used the ":cd" command.
  1111. X
  1112. XWhen writing the buffer, the default is to use the current filename. Thus 
  1113. Xwhen you give the "ZZ" or ":wq" command, the original file will be 
  1114. Xoverwritten. If you do not want this, the buffer can be written into another 
  1115. Xfile by giving a filename argument to the ":write" command. For example:
  1116. X    
  1117. X    vim testfile
  1118. X    [change the buffer with editor commands]
  1119. X    :w newfile
  1120. X    :q
  1121. X
  1122. XThis will create a file "newfile", that is a modified copy of "testfile". 
  1123. XThe file "testfile" will remain unchanged. Anyway, if the 'backup' option is 
  1124. Xset, Vim renames the original file before it will be overwritten. You can 
  1125. Xuse this file if you discover that you need the original file. The name of 
  1126. Xthe backup file is the same as the original file with ".bak" appended. Any 
  1127. X<.> is replaced by <_> on MSDOS machines, when Vim has detected that an 
  1128. XMSDOS-like filesystem is being used (e.g. messydos or crossdos) and when the 
  1129. X'shortname' option is set.
  1130. X
  1131. XTechnical: On the Amiga you can use 30 characters for a file name. But on an 
  1132. X       MSDOS-compatible filesystem only 8 plus 3 characters are 
  1133. END_OF_FILE
  1134. if test 47200 -ne `wc -c <'vim/doc/reference.do1'`; then
  1135.     echo shar: \"'vim/doc/reference.do1'\" unpacked with wrong size!
  1136. fi
  1137. chmod +x 'vim/doc/reference.do1'
  1138. # end of 'vim/doc/reference.do1'
  1139. fi
  1140. echo shar: End of archive 23 \(of 25\).
  1141. cp /dev/null ark23isdone
  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.