home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / vim45os2.zip / vim-4.5 / doc / vim_ref.txt < prev    next >
Text File  |  1996-10-15  |  437KB  |  10,086 lines

  1. *vim_ref.txt*   For Vim version 4.5.  Last modification: 1996 Oct 2
  2.  
  3.  
  4.                  VIM REFERENCE MANUAL
  5.  
  6.                   By Bram Moolenaar
  7.  
  8.  
  9.  
  10. There is a contents listing at the end of this document.
  11.  
  12. This manual mostly assumes that there is only one window.  The commands and
  13. options for multiple windows and buffers are explained in |vim_win.txt|.
  14.  
  15. This manual describes running Vim from a normal terminal or with a terminal
  16. emulator in a window.  See |vim_gui.txt| for the GUI version.
  17.  
  18. You can use tags to jump to the explanation of a subject.  Position the cursor
  19. on an item name between bars (e.g., |intro|) or an option name in single
  20. quotes (e.g., 'textwidth' ) and hit CTRL-].  This mostly also works on a
  21. command in double quotes (e.g., ":buf").  Three special characters in the
  22. names of the tags are not allowed.  They have been replaced with letters:
  23. "bar" for '|', "star" for '*', and "quote" for '"'.
  24.  
  25.                    tag starts with    example
  26.        Normal and Visual mode    nothing        |x|
  27.                   Visual mode    "v_"        |v_u|
  28.               Insert mode    "i_"        |i_<Esc>|
  29.     Command line commands    ":"        |:quit|
  30.      Command line editing    "c_"        |c_<Del>|
  31.       Vim command options    "-"        |-r|
  32.           Vim options    "'"        |'shell'|
  33.  
  34.  
  35. 1. Introduction                        *intro*
  36. ===============
  37.  
  38. Vim stands for Vi IMproved.  It used to be Vi IMitation, but there are so many
  39. improvements that a name change was appropriate.  Vim is a text editor which
  40. includes almost all the commands from the Unix program "Vi" and a lot of new
  41. ones.  It is very useful for editing programs and other 8-bit ASCII text.  All
  42. commands are given with the keyboard.  This has the advantage that you can
  43. keep your fingers on the keyboard and your eyes on the screen.  For those who
  44. want it, there is mouse support and a GUI version with scrollbars and menus
  45. (see |vim_gui.txt|).
  46.  
  47. Throughout this manual the differences between Vi and Vim are mentioned in
  48. curly braces.  See |vim_diff.txt| for a summary of the differences.
  49.  
  50. This manual refers to Vim on various machines.  There may be small differences
  51. between different computers and terminals.  Besides the remarks given in this
  52. document, there is a separate document for each supported system:
  53.       system                see
  54.     Amiga                |vim_ami.txt|
  55.     Archimedes            |vim_arch.txt|
  56.     Atari MiNT                  |vim_mint.txt|
  57.     Macintosh            |vim_mac.txt|
  58.     MS-DOS                |vim_dos.txt|
  59.     OS/2                |vim_os2.txt|
  60.     Unix                |vim_unix.txt|
  61.     Win32: Windows NT / Windows 95    |vim_w32.txt|
  62.  
  63. This manual is a reference for all the Vim commands and options.  This is not
  64. an introduction to the use of Vim.  There are many books on vi that contain a
  65. section for beginners.
  66.  
  67. A summary of this manual can be found in the file "vim_help.txt",
  68. |vim_help.txt|.  It can be accessed from within Vim with the <Help> or <F1>
  69. key and with the command ":help", |:help|.  The 'helpfile' option can be set
  70. to the name of the help file, so you can put it in any place you like.
  71.  
  72.  
  73. 2. Notation                        *notation*
  74. ===========
  75.  
  76. []        Characters in square brackets are optional.
  77.  
  78.                             *count*
  79. [count]        An optional number that may precede the command to multiply
  80.         or iterate the command.  If no number is given, a count of one
  81.         is used, unless otherwise noted.  Note that in this manual the
  82.         [count] is not mentioned in the description of the command,
  83.         but only in the explanation.  This was done to make the
  84.         commands easier to lookup.  If the "sc" option is on
  85.         (|'showcmd'|), the (partially) entered count is shown at the
  86.         bottom of the window.  You can use <Del> to erase the last
  87.         digit (|N<Del>|).
  88.  
  89. ["x]        An optional register designation where text can be stored.
  90.         See |registers|.  The x is a single character between 'a' and
  91.         'z' or 'A' and 'Z' or '"', and in some cases (with the put
  92.         command) between '0' and '9', '%', ':', or '.'.  The uppercase
  93.         and lowercase letters designate the same register, but the
  94.         lowercase letter is used to overwrite the previous register
  95.         contents, while the uppercase letter is used to append to the
  96.         previous register contents.  Without the ""x" or with """",
  97.         the stored text is put into the unnamed register.
  98.  
  99. {}        Curly braces denote parts of the command which must appear,
  100.         but which can take a number of different values.  The
  101.         differences between Vim and Vi are also given in curly braces
  102.         (this will be clear from the context).
  103.  
  104.                             *{motion}*
  105. {motion}    A command that moves the cursor.  See the list in chapter 6,
  106.         |cursor_motions|.  This is used after an operator command
  107.         |operator| to move over the text that is to be operated upon.
  108.         If the motion includes a count and the operator also had a
  109.         count, the two counts are multiplied.  For example: "2d3w"
  110.         deletes six words.  The motion can also be a mouse click.  The
  111.         mouse is currently only supported for MS-DOS, Win32 and xterm
  112.         under Unix.
  113.  
  114.                             *{Visual}*
  115. {Visual}    A piece of text that is started with the "v", "V", or CTRL-V
  116.         command and ended by the cursor position.  This is used
  117.         before an operator command |operator| to highlight the text
  118.         that is to be operated upon.  See the chapter on Visual mode
  119.         |Visual_mode|.
  120.  
  121. <character>    A special character from the table below or a single ASCII
  122.         character.
  123.  
  124. 'character'    A single ASCII character.
  125.  
  126. <char1-char2>    A single character from the range <char1> to <char2>.  For
  127.         example: <a-z> is a lowercase letter.  Multiple ranges may be
  128.         concatenated.  For example, <a-zA-Z0-9> is any alphanumeric
  129.         character.
  130.  
  131. CTRL-{char}    {char} typed as a control character; that is, typing {char}
  132.         while holding the CTRL key down.  The case of {char} does not
  133.         matter; thus CTRL-A and CTRL-a are equivalent.  But on some
  134.         terminals, using the SHIFT key will produce another code,
  135.         don't use it then.
  136.  
  137. 'option'    An option, or parameter, that can be set to a value, is
  138.         enclosed in single quotes.  See chapter 19, |options|.
  139.  
  140. "command"    In examples, the commands you can type are enclosed in double
  141.         quotes.
  142.  
  143.                                 *key_notation*
  144. notation    meaning            equivalent    decimal value(s)
  145. -----------------------------------------------------------------------
  146. <Nul>        zero            CTRL-@      0 (stored as 10)
  147. <BS>        backspace        CTRL-H      8    *backspace*
  148. <Tab>        tab            CTRL-I      9    *tab*
  149.                             *linefeed*
  150. <NL>        linefeed        CTRL-J     10 (used for <Nul>)
  151.                             *carriage return*
  152. <CR>        carriage return        CTRL-M     13
  153. <Esc>        escape            CTRL-[     27    *escape*
  154. <Space>        space                 32    *space*
  155. <Del>        delete                127
  156.  
  157. <Up>        cursor-up            *cursor-up* *cursor_up*
  158. <Down>        cursor-down            *cursor-down* *cursor_down*
  159. <Left>        cursor-left            *cursor-left* *cursor_left*
  160. <Right>        cursor-right            *cursor-right* *cursor_right*
  161. <S-Up>        shift-cursor-up
  162. <S-Down>    shift-cursor-down
  163. <S-Left>    shift-cursor-left
  164. <S-Right>    shift-cursor-right
  165. <F1> - <F12>    function keys 1 to 12        *function_key* *function-key*
  166. <S-F1> - <S-F12> shift-function keys 1 to 12
  167. <Help>        help key
  168. <Undo>        undo key
  169. <Insert>    insert key
  170. <Home>        home                *home*
  171. <End>        end                *end*
  172. <PageUp>    page-up                *page_up* *page-up*
  173. <PageDown>    page-down            *page_down* *page-down*
  174. <kHome>        keypad home (upper left)    *keypad_home*
  175. <kEnd>        keypad end (lower left)        *keypad_end*
  176. <kPageUp>    keypad page-up (upper right)    *keypad_page_up*
  177. <kPageDown>    keypad page-down (lower right)    *keypad_page_down*
  178. <S-...>        shift-key            *shift*
  179. <C-...>        control-key            *control* *ctrl*
  180. <M-...>        alt-key or meta-key        *meta* *alt*
  181. <t_xx>        key with "xx" entry in termcap
  182. -----------------------------------------------------------------------
  183.  
  184. Note: The shifted cursor keys, the help key, and the undo key are only
  185. available on a few terminals.  On the Amiga, shifted function key 10 produces
  186. a code (CSI) that is also used by key sequences.  It will be recognized only
  187. after typing another key.
  188.  
  189. Note: There are two codes for the delete key.  127 is the decimal ASCII value
  190. for the delete key, which is always recognized.  Some delete keys send another
  191. value, in which case this value is obtained from the termcap entry "kD".  Both
  192. values have the same effect.  Also see |:fixdel|.
  193.  
  194. Note: The keypad keys are used in the same way as the corresponding "normal"
  195. keys.  For example, <kHome> has the same effect as <Home>.  If a keypad key
  196. sends the same raw key code as it non-keypad equivalent, it will be recognized
  197. as the non-keypad code.  For example, when <kHome> sends the same code as
  198. <Home>, when pressing <kHome> Vim will think <Home> was pressed.  Mapping
  199. <kHome> will not work then.
  200.  
  201.                                 *<>*
  202. Some of the examples are given in the <> notation.  The rules are:
  203.  1.  Any printable characters are typed directly, except backslash and '<'
  204.  2.  A backslash is represented with "\\", double backslash.
  205.  3.  A real '<' is represented with "\<".
  206.  4.  "<key>" means the special key typed.  This is the notation explained in
  207.      the table above.  A few examples:
  208.        <Esc>        Escape key
  209.        <C-G>        CTRL-G
  210.        <Up>            cursor up key
  211.        <C-LeftMouse>    Control- left mouse click
  212.        <S-F11>        Shifted function key 11
  213.        <M-a>        Meta- a  ('a' with bit 8 set)
  214.        <M-A>        Meta- A  ('A' with bit 8 set)
  215.        <t_kd>        "kd" termcap entry (cursor down key)
  216.  
  217. If you want to use the full <> notation in Vim, you have to remove the 'B'
  218. flag from 'cpoptions' and make sure the '<' flag is excluded (it already is by
  219. default).
  220.     :set cpo=ceFs
  221. If you have the 'B' flag in 'cpoptions', then <> notation mostly still works,
  222. but you can't escape the special meaning of key names in <> with a backslash.
  223. To distinguish using <> with and without the 'B' flag, it's called full <>
  224. notation if the 'B' flag is excluded.
  225. For mapping, abbreviation and menu commands you can then copy-paste the
  226. examples and use them directly.  Or type them literally, including the '<' and
  227. '>' characters.  This does NOT work for other commands, like ":set" and
  228. ":autocmd"!
  229.  
  230.  
  231. 3. Starting Vim                        *starting*
  232. ===============
  233.  
  234. 3.1 Vim arguments                    *vim_arguments*
  235.  
  236. Most often, Vim is started to edit a single file with the command
  237.  
  238.     vim file                    *-vim*
  239.  
  240. More generally, Vim is started with:
  241.  
  242.     vim [options] [arglist]
  243.  
  244. If the arglist is missing, the editor will start with an empty buffer.
  245. Otherwise exactly one out of the following three may be used to choose one
  246. or more files to be edited.
  247.  
  248.                             *-file* *--*
  249. file ..        A list of file names.  The first one will be the current file
  250.         and read into the buffer.  The cursor will be positioned on
  251.         the first line of the buffer.  To avoid a file name starting
  252.         with a '-' being interpreted as an option, precede the arglist
  253.         with "--", e.g.:
  254.             Vim -- -filename
  255.  
  256.                             *-t* *-tag*
  257. -t {tag}    A tag.  "tag" is looked up in the tags file, the associated
  258.         file becomes the current file, and the associated command is
  259.         executed.  Mostly this is used for C programs.  In that case,
  260.         "tag" should be a function name.  The effect is that the file
  261.         containing that function becomes the current file and the
  262.         cursor is positioned on the start of the function (see the
  263.         section on tags, |tags|).
  264.  
  265.                             *-e* *-qf*
  266. -e [errorfile]    QuickFix mode.  The file with the name [errorfile] is read
  267.         and the first error is displayed.  If [errorfile] is not
  268.         given, the 'errorfile' option is used for the file name
  269.         (default "AztecC.Err" for the Amiga, "errors.vim" for other
  270.         systems).  See section 5.5: "using the QuickFix mode",
  271.         |quickfix|.  {not in Vi}
  272.  
  273.                             *startup-options*
  274. The options, if present, must precede the arglist.  The options may be given
  275. in any order.  Single-letter options can be combined after one dash.
  276.  
  277.                             *-+*
  278. +[num]        The cursor will be positioned on line "num" for the first
  279.         file being edited.  If "num" is missing, the cursor will be
  280.         positioned on the last line.
  281.  
  282.                             *-+/*
  283. +/{pat}        The cursor will be positioned on the first line containing
  284.         "pat" in the first file being edited (see the section
  285.         "pattern searches" for the available search patterns,
  286.         |search_pattern|).
  287.  
  288. +{command}                        *-+c* *-c*
  289. -c {command}    "command" will be executed after the first file has been
  290.         read (and after autocommands and modelines for that file have
  291.         been processed).  "command" is interpreted as an Ex command.
  292.         If the "command" contains spaces, it must be enclosed in
  293.         double quotes (this depends on the shell that is used).
  294.         Example: vim "+set si" main.c
  295.  
  296.         Note: You can use only one "+" or "-c" argument in a Vim
  297.         command.
  298.  
  299.                             *-r*
  300. -r        Recovery mode.  Without a file name argument, a list of
  301.         existing swap files is given.  With a file name, a swap file
  302.         is read to recover a crashed editing session.  See the
  303.         chapter "Recovery after a crash", |crash_recovery|.
  304.  
  305.                             *-L*
  306. -L        Same as -r.  {only in some versions of Vi: "List recoverable
  307.         edit sessions"}
  308.  
  309.                             *-v*
  310. -v        View mode.  The 'readonly' option will be set for all the
  311.         files being edited.  You can still edit the buffer, but will
  312.         be prevented from accidentally overwriting a file.  If you
  313.         forgot that you are in View mode and did make some changes,
  314.         you can overwrite a file by adding an exclamation mark to
  315.         the Ex command, as in ":w!".  The 'readonly' option can be
  316.         reset with ":set noro" (see the options chapter, |options|).
  317.         Subsequent edits will not be done in readonly mode.  Calling
  318.         the executable "view" has the same effect as the -v option.
  319.         If your system does not support links and you do not want to
  320.         have the executable twice, you could make an alias: "alias
  321.         view vim -v".  The 'updatecount' option will be set to 10000,
  322.         meaning that the swap file will not be updated automatically
  323.         very often.  {Vi: "ex -v" means to start ex in vi mode.
  324.         "vi -v" does nothing}
  325.  
  326.                             *-R*
  327. -R        Readonly mode.  Same as -v.
  328.  
  329.                             *-b*
  330. -b        Binary mode.  The 'textauto', 'textmode', and 'expandtab'
  331.         options will be reset.  The 'textwidth' option is set to 0.
  332.         'modeline' is reset.  The 'binary' option is set.  This is
  333.         done after reading the vimrc/exrc files but before reading
  334.         any file in the arglist.  See also 5.6:
  335.         "Editing binary files", |edit_binary|.  {not in Vi}
  336.  
  337.                             *-l*
  338. -l        Lisp mode.  Sets the 'lisp' and 'showmatch' options on.
  339.  
  340.                             *-H*
  341. -H        Hebrew mode.  Sets the 'hkmap' and 'rightleft' options on.
  342.         (Only when compiled with LEFTRIGHT defined, otherwise Vim
  343.         gives an error message and exits).  {not in Vi}
  344.  
  345.                             *-n*
  346. -n        No swap file will be used.  Recovery after a crash will be
  347.         impossible.  Handy if you want to view or edit a file on a
  348.         very slow medium (e.g., a floppy).  Can also be done with
  349.         ":set updatecount=0".  You can switch it on again by setting
  350.         the 'updatecount' option to some value, e.g., ":set uc=100".
  351.         {not in Vi}
  352.  
  353.                             *-o*
  354. -o[N]        Open N windows.  If [N] is not given, one window is opened
  355.         for every file given as argument.  If there is not enough
  356.         room, only the first few files get a window.  If there are
  357.         more windows than arguments, the last few windows will be
  358.         editing an empty file.  {not in Vi}
  359.  
  360.                             *-T*
  361. -T {terminal}    Set the terminal type to "terminal".  This influences the
  362.         codes that Vim will send to your terminal.  This is normally
  363.         not needed, because Vim will be able to find out what type
  364.         of terminal you are using (See chapter 20, |terminal_info|).
  365.         {not in Vi}
  366.  
  367.                             *-d*
  368. -d {device}    Amiga only: The "device" is opened to be used for editing.
  369.         Normally you would use this to set the window position and
  370.         size: "-d con:x/y/width/height", e.g.,
  371.         "-d con:30/10/600/150".  But you can also use it to start
  372.         editing on another device, e.g., AUX:.  {not in Vi}
  373.  
  374.                             *-x*
  375. -x        Amiga only: Do not restart Vim to open a new window.  This
  376.         option should be used when Vim is started by a program that
  377.         will wait for the edit session to finish (e.g., mail or
  378.         readnews).  See section 3.3, |amiga_window|.  {not in Vi}
  379.  
  380.                             *-f*
  381. -f        GUI only: Do not disconnect from the program that started Vim.
  382.         'f' stands for "foreground".  If omitted, the GUI forks a new
  383.         process and exits the current one.  "-f" should be used when
  384.         gvim is started by a program that will wait for the edit
  385.         session to finish (e.g., mail or readnews).  If you want gvim
  386.         never to fork, include 'f' in 'guioptions'.  Careful: You can
  387.         use "-gf" to start the GUI in the foreground, but "-fg" is
  388.         used to specify the foreground color.  {not in Vi} |gui_fork|
  389.  
  390.                             *-u*
  391. -u {vimrc}    The file "vimrc" is read for initializations.  Other
  392.         initializations are skipped; see |initialization|.  This can
  393.         be used to start Vim in a special mode, with special
  394.         mappings and settings.  A shell alias can be used to make
  395.         this easy to use.  For example:
  396.             "alias vimc vim -u ~/.c_vimrc !*".
  397.         Also consider using autocommands; see |autocommand|.
  398.         When {vimrc} is equal to "NONE" (all uppercase), all
  399.         initializations from files and environment variables are
  400.         skipped.  {not in Vi}
  401.  
  402.                             *-i*
  403. -i {viminfo}    The file "viminfo" is used instead of the default viminfo
  404.         file.  If the name "NONE" is used (all uppercase), no viminfo
  405.         file is read or written, even if 'viminfo' is set or when
  406.         ":rv" or ":wv" are used.  See also |viminfo_file|.  {not in Vi}
  407.  
  408.                             *-s*
  409. -s {scriptin}    The script file "scriptin" is read.  The characters in the
  410.         file are interpreted as if you had typed them.  The same can
  411.         be done with the command ":source! {scriptin}".  If the end
  412.         of the file is reached before the editor exits, further
  413.         characters are read from the keyboard.  See also the section
  414.         "complex repeats", |complex_repeat|.  {not in Vi}
  415.  
  416.                             *-w*
  417. -w {scriptout}    All the characters that you type are recorded in the file
  418.         "scriptout", until you exit Vim.  This is useful if you want
  419.         to create a script file to be used with "vim -s" or
  420.         ":source!".  When the "scriptout" file already exists, new
  421.         characters are appended.  See also the section "complex
  422.         repeats", |complex_repeat|.  {not in Vi}
  423.  
  424.                             *-W*
  425. -W {scriptout}    Like -w, but do not append, overwrite an existing file.  {not
  426.         in Vi}
  427.  
  428.                             *-w_nr*
  429. -w{number}    Does nothing.  This was included for Vi-compatibility.  In Vi
  430.         it sets the 'window' option, which is not implemented in Vim.
  431.  
  432. Example for using a script file to change a name in several files:
  433.     Create a file "subs.vi" containing substitute commands and a :wq
  434.     command:
  435.  
  436.         :%s/Jones/Smith/g
  437.         :%s/Allen/Peter/g
  438.         :wq
  439.  
  440.     Execute Vim on all files you want to change:
  441.  
  442.         foreach i ( *.let ) vim -s subs.vi $i
  443.  
  444. If the executable is called "view", Vim will start in Readonly mode.  This is
  445. useful if you can make a hard or symbolic link from "view" to "vim".
  446. Starting in Readonly mode can also be done with "vim -v".
  447.  
  448.  
  449. 3.2 Workbench (Amiga only)                *workbench*
  450.  
  451. Vim can be started from the workbench by clicking on its icon twice.  It will
  452. then start with an empty buffer.
  453.  
  454. Vim can be started to edit one or more files by using a "Project" icon.  The
  455. "Default Tool" of the icon must be the full pathname of the Vim executable.
  456. The name of the ".info" file must be the same as the name of the text file.
  457. By clicking on this icon twice, Vim will be started with the filename as
  458. current filename, which will be read into the buffer (if it exists).  You can
  459. edit multiple files by pressing the shift key while clicking on icons, and
  460. clicking twice on the last one.  The "Default Tool" for all these icons must
  461. be the same.
  462.  
  463. It is not possible to give arguments to Vim, other than filenames, from the
  464. workbench.
  465.  
  466.  
  467. 3.3 Vim window (Amiga only)                *amiga_window*
  468.  
  469. Vim will run in the CLI window where it was started.  If Vim was started with
  470. the "run" or "runback" command, or if Vim was started from the workbench, it
  471. will open a window of its own.
  472.  
  473. Technical detail:
  474.     To open the new window a little trick is used.  As soon as Vim
  475.     recognizes that it does not run in a normal CLI window, it will
  476.     create a script file in "t:".  This script file contains the same
  477.     command as the one Vim was started with, and an "endcli" command.  This
  478.     script file is then executed with a "newcli" command (the "c:run" and
  479.     "c:newcli" commands are required for this to work).  The script file
  480.     will hang around until reboot, or until you delete it.  This method
  481.     is required to get the ":sh" and ":!" commands to work correctly.
  482.     But when Vim was started with the -e option (Quickfix mode) or with
  483.     the -x option, this method is not used.  The reason for this is that
  484.     when a compiler starts Vim with the -e option it will wait for a
  485.     return code.  With the script trick, the compiler cannot get the
  486.     return code.  The -x option can be used when Vim is started by a mail
  487.     program which also waits for the edit session to finish.  As a
  488.     consequence, the ":sh" and ":!" commands are not available when the
  489.     -e or -x option is used.
  490.  
  491. Vim will automatically recognize the window size and react to window
  492. resizing.  Under Amiga DOS 1.3, it is advised to use the fastfonts program,
  493. "FF", to speed up display redrawing.
  494.  
  495.  
  496. 3.4 Initialization                *initialization* *startup*
  497.  
  498. This section is about the non-GUI version of Vim.  See |gui_fork| for
  499. additional initialization when starting the GUI.
  500.  
  501. At startup, Vim checks environment variables and files and sets values
  502. accordingly.  Vim proceeds in this order:
  503.  
  504. 1. Setting the 'shell' option                *SHELL* *COMSPEC*
  505.     The environment variable SHELL, if it exists, is used to set the
  506.     'shell' option.  On MS-DOS and Win32, the COMPSPEC variable is used
  507.     if SHELL is not set.
  508.  
  509. 2. Setting the 'term' option                *TERM*
  510.     The environment variable TERM, if it exists, is used to set the 'term'
  511.     option.
  512.  
  513. 3. Reading Ex commands from environment variables and/or files
  514.     An environment variable is read as one Ex command line, where multiple
  515.     commands must be separated with '|' or "<NL>".
  516.                                 *vimrc* *exrc*
  517.     A file that contains initialization commands is called a "vimrc" file.
  518.     Each line in a vimrc file is executed as an Ex command line.  It is
  519.     sometimes also referred to as "exrc" file.  They are the same type of
  520.     file, but "exrc" is what Vi always used, "vimrc" is a Vim specific
  521.     name.
  522.  
  523.     If Vim was started with "-u filename", the file "filename" is used.
  524.     All following initializations until 4. are skipped.
  525.     "vim -u NONE" can be used to skip these initializations.  |-u|
  526.  
  527.      a. For Unix the system vimrc file is read for initializations.  The path
  528.     of this file is shown with the ":version" command.
  529.  
  530.               *VIMINIT* *.vimrc* *_vimrc* *EXINIT* *.exrc* *_exrc*
  531.      b. Four places are searched for initializations.  The first that exists
  532.     is used, the others are ignored.
  533.     -  The environment variable VIMINIT
  534.     -  The user vimrc file:
  535.             "~/.vimrc"       (for Unix and OS/2)
  536.             "s:.vimrc"     (for Amiga)
  537.             "$VIM\_vimrc"  (for MS-DOS and Win32)
  538.         Note: For Unix, OS/2 and Amiga, when ".vimrc" does not exist,
  539.         "_vimrc" is also tried, in case an MS-DOS compatible file
  540.         system is used.  For MS-DOS and Win32 ".vimrc" is checked
  541.         after "_vimrc", in case long file names are used.
  542.         If $VIM is not set, $HOME is used.
  543.     -  The environment variable EXINIT
  544.     -  The user exrc file:
  545.             "~/.exrc"      (for Unix and OS/2)
  546.                 "s:.exrc"      (for Amiga)
  547.             "$VIM\_exrc"   (for MS-DOS and Win32).
  548.  
  549.      c. If the 'exrc' option is on (which is not the default), the current
  550.     directory is searched for three files.  The first that exists is used,
  551.     the others are ignored.
  552.     -  The file ".vimrc" (for Unix, Amiga and OS/2)
  553.                 "_vimrc" (for MS-DOS and Win32)
  554.     -  The file "_vimrc" (for Unix, Amiga and OS/2)
  555.                 ".vimrc" (for MS-DOS and Win32)
  556.     -  The file ".exrc"  (for Unix, Amiga and OS/2)
  557.                 "_exrc"  (for MS-DOS and Win32)
  558.  
  559. 4. Setting 'shellpipe' and 'shellredir'
  560.     The 'shellpipe' and 'shellredir' options are set according to the
  561.     value of the 'shell' option, unless they have been set before.
  562.     This means that Vim will figure out the values of 'shellpipe' and
  563.     'shellredir' for you, unless you have set them yourself.
  564.  
  565. 5. Read the viminfo file
  566.     If the 'viminfo' option is not empty, the viminfo file is read.  The
  567.     default is empty, so 'viminfo' must have been set by one of the
  568.     previous initializations.  See |viminfo_file|.
  569.  
  570. Some hints on using initializations:
  571.  
  572. Standard setup:
  573. Create a vimrc file to set the default settings and mappings for all your edit
  574. sessions.  Put it in a place so that it will be found by 3b:
  575.     ~/.vimrc    (Unix and OS/2)
  576.     s:.vimrc    (Amiga)
  577.     $VIM\_vimrc    (MS-DOS and Win32)
  578.  
  579. Local setup:
  580. Put all commands that you need for editing a specific directory only into a
  581. vimrc file and place it in that directory under the name ".vimrc" ("_vimrc"
  582. for MS-DOS and Win32).  NOTE: To make Vim look for these special files you
  583. have to turn on the option 'exrc'.  See |trojan_horse| too.
  584.  
  585. System setup:
  586. This only applies if you are managing a Unix system with several users and
  587. want to set the defaults for all users.  Create a vimrc file with commands
  588. for default settings and mappings and put it in the place that is given with
  589. the ":version" command.
  590.  
  591. Saving the current state of Vim to a file:
  592. Whenever you have changed values of options or when you have created a
  593. mapping, then you may want to save them in a vimrc file for later use.  See
  594. |save_settings| about saving the current state of settings to a file.
  595.  
  596. Avoiding setup problems for Vi users:
  597. Vi uses the variable EXINIT and the file "~/.exrc".  So if you do not want to
  598. interfere with Vi, then use the variable VIMINIT and the file "vimrc" instead.
  599.  
  600. Amiga environment variables:
  601. On the Amiga, two types of environment variables exist.  The ones set with the
  602. DOS 1.3 (or later) setenv command are recognized.  See the AmigaDos 1.3
  603. manual.  The environment variables set with the old Manx Set command (before
  604. version 5.0) are not recognized.
  605.  
  606. MS-DOS line separators:
  607. On MS-DOS-like systems (MS-DOS itself, Win32, and OS/2), Vim assumes that all
  608. the vimrc files have <CR><NL> pairs as line separators.  This will give
  609. problems if you have a file with only <NL>s and have a line like
  610. ":map xx yy^M".  The trailing ^M will be ignored.
  611.  
  612. Avoiding trojan horses:                    *trojan_horse*
  613. While reading the "vimrc" or the "exrc" file in the current directory, some
  614. commands can be disabled for security reasons by setting the 'secure' option.
  615. This is always done when executing the command from a tags file.  Otherwise it
  616. would be possible that you accidentally use a vimrc or tags file that somebody
  617. else created and contains nasty commands.  The disabled commands are the ones
  618. that start a shell, the ones that write to a file, and ":autocmd".  The ":map"
  619. commands are echoed, so you can see which keys are being mapped.
  620.     If you want Vim to execute all commands in a local vimrc file, you
  621. can reset the 'secure' option in the EXINIT or VIMINIT environment variable or
  622. in the global "exrc" or "vimrc" file.  This is not possible in "vimrc" or
  623. "exrc" in the current directory, for obvious reasons.
  624.     On Unix systems, this only happens if you are not the owner of the
  625. vimrc file.  Warning: If you unpack an archive that contains a vimrc or exrc
  626. file, it will be owned by you.  You won't have the security protection.  Check
  627. the vimrc file before you start Vim in that directory, or reset the 'exrc'
  628. option.  Some Unix systems allow a user to do "chown" on a file.  This makes
  629. it possible for another user to create a nasty vimrc and make you the owner.
  630. Be careful!
  631.     When using tag search commands, executing the search command (the last
  632. part of the line in the tags file) is always done in secure mode.  This works
  633. just like executing a command from a vimrc/exrc in the current directory.
  634.  
  635.                             *slow_start*
  636. If Vim takes a long time to start up, there may be a few causes:
  637. - If the Unix version was compiled with the GUI and/or X11 (check the output
  638.   of ":version" for "+GUI" and "+X11"), it may need to load shared libraries
  639.   and connect to the X11 server.  Try compiling a version with GUI and X11
  640.   disabled.  This also should make the executable smaller.
  641. - If you have "viminfo" enabled, the loading of the viminfo file may take a
  642.   while.  You can find out if this is the problem by disabling viminfo for a
  643.   moment (use the Vim argument "-i NONE", |-i|).  Try reducing the number of
  644.   lines stored in a register with ":set viminfo='20\"50".
  645.                               |viminfo_file|.
  646.  
  647.  
  648. 3.5 Suspending                        *suspend*
  649.  
  650.                             *CTRL-Z* *v_CTRL-Z*
  651. CTRL-Z            On Unix systems: Suspend Vim.  On other systems:
  652.             start a new shell (like ":sh").  Same as ":stop".
  653.             Works in Normal and in Visual mode.  In Insert and
  654.             Command-line mode, the CTRL-Z is inserted as a normal
  655.             character.
  656.  
  657.  
  658. :sus[pend][!]    or            *:sus* *:suspend* *:st* *:stop*
  659. :st[op][!]        Suspend the editor.  If the '!' is not given, the
  660.             buffer was changed, 'autowrite' is set, and a filename
  661.             is known, the buffer will be written.
  662.  
  663. On many Unix systems, it is possible to suspend Vim with CTRL-Z.  This is only
  664. possible in Normal and Visual mode (see next chapter, |vim_modes|).  Vim will
  665. continue if you make it the foreground job again.  On other systems, CTRL-Z
  666. will start a new shell.  This is the same as the ":sh" command.  Vim will
  667. continue if you exit from the shell.
  668.  
  669.  
  670. 3.6 The viminfo file                    *viminfo_file*
  671.  
  672. The viminfo file is used to store:
  673. - The command line history.
  674. - The search string history.
  675. - Contents of registers.
  676. - Marks for several files.
  677. - File marks, pointing to locations in files.
  678. - Last search/substitute pattern (for 'n' and '&').
  679.  
  680. The viminfo file is only supported when Vim has been compiled with VIMINFO
  681. defined.  If the output of ":version" contains "+viminfo" then it was; if it
  682. contains "-viminfo" then it wasn't.  By default, VIMINFO is defined.
  683.  
  684. When Vim is started and the 'viminfo' option is non-empty, the contents of
  685. the viminfo file are read and the info can be used in the appropriate places.
  686. The marks are not read in at startup (but file marks are).  See
  687. |initialization| for how to set the 'viminfo' option upon startup.
  688.  
  689. When Vim is exited and 'viminfo' is non-empty, the info is stored in the
  690. viminfo file (it's actually merged with the existing one, if one exists).  The
  691. 'viminfo' option is a string containing information about what info should be
  692. stored, and contains limits on how much should be stored (see 'viminfo').
  693.  
  694. Marks are stored for each file separately.  When a file is read and 'viminfo'
  695. is non-empty, the marks for that file are read from the viminfo file.  NOTE:
  696. The marks are only written when exiting Vim, which is fine because marks are
  697. remembered for all the files you have opened in the current editing session,
  698. unless ":bdel" is used.  If you want to save the marks for a file that you are
  699. about to abandon with ":bdel", use ":wv".  The '[' and ']' marks are not
  700. stored, but the '"' mark is.  The '"' mark is very useful for jumping to the
  701. cursor position when the file was last exited.  No marks are saved for files
  702. that start with any string given with the "r" flag in 'viminfo'.  This can be
  703. used to avoid saving marks for files on removable media (for MS-DOS you would
  704. use "ra:,rb:", for Amiga "rdf0:,rdf1:,rdf2:").
  705.  
  706.                             *viminfo_file_marks*
  707. Uppercase marks ('A to 'Z) are stored when writing the viminfo file.  The
  708. numbered marks ('0 to '9) are a bit special.  When the viminfo file is written
  709. (when exiting or with the ":wviminfo" command), '0 is set to the current cursor
  710. position and file.  The old '0 is moved to '1, '1 to '2, etc.  This
  711. resembles what happens with the "1 to "9 delete registers.  If the current
  712. cursor position is already present in '0 to '9, it is moved to '0, to avoid
  713. having the same position twice.  The result is that with "'0", you can jump
  714. back to the file and line where you exited Vim.
  715.  
  716. The default name of the viminfo file is "$HOME/.viminfo" for Unix,
  717. "s:.viminfo" for Amiga, "$VIM\viminfo" for MS-DOS and Win32.  The "-i" Vim
  718. argument can be used to set another file name, |-i|.  For the commands below,
  719. another file name can be given, overriding the default and the name given with
  720. "-i".  When the file name given with the "-i" Vim argument is "NONE"
  721. (all uppercase), no viminfo file is ever read or written.
  722.  
  723. Two commands can be used to read and write the viminfo file manually.  This
  724. can be used to exchange registers between two running Vim programs: First
  725. type ":wv" in one and then ":rv" in the other.  Note that if the register
  726. already contained something, then ":rv!" would be required.  Also note
  727. however that this means everything will be overwritten with information from
  728. the first Vim, including the command line history, etc.
  729.  
  730. The viminfo file itself can be edited by hand too, although we suggest you
  731. start with an existing one to get the format right.  It is reasonably
  732. self-explanatory once you're in there.  This can be useful in order to
  733. create a second file, say "~/.my_viminfo" which could contain certain
  734. settings that you always want when you first start Vim.  For example, you
  735. can preload registers with particular data, or put certain commands in the
  736. command line history.  A line in your .vimrc file like
  737.     rviminfo! ~/.my_viminfo
  738. can be used to load this information.  You could even have different viminfos
  739. for different types of files (e.g., C code) and load them based on the file
  740. name, using the ":autocmd" command (see |:autocmd|).
  741.  
  742.                             *viminfo_errors*
  743. When Vim detects an error while reading a viminfo file, it will not overwrite
  744. that file.  If there are more than 10 errors, Vim stops reading the viminfo
  745. file.  This was done to avoid accidently destroying a file when the filename
  746. of the viminfo file is wrong.  This could happen when accidently typing "vim
  747. -i file" when you wanted "vim -v file" (yes, somebody accidently did that!).
  748. If you want to overwrite a viminfo file with an error in it, you will either
  749. have to fix the error, or delete the file (while Vim is running, so most of
  750. the information will be restored).
  751.  
  752.                            *:rv* *:rviminfo*
  753. :rv[iminfo][!] [file]    Read from viminfo file [file] (default: see above).
  754.             If [!] is given, then any information that is
  755.             already set (registers, marks, etc.) will be
  756.             overwritten.  {not in Vi}
  757.  
  758.                            *:wv* *:wviminfo*
  759. :wv[iminfo][!] [file]    Write to viminfo file [file] (default: see above).
  760.             The information in the file is first read in to make
  761.             a merge between old and new info.  When [!] is used,
  762.             the old information is not read first, only the
  763.             internal info is written.  If 'viminfo' is empty, marks
  764.             for up to 100 files will be written.  {not in Vi}
  765.  
  766.  
  767. 4. Modes                        *vim_modes*
  768. ========
  769.  
  770. 4.1 Introduction
  771.  
  772. Vim has four BASIC modes:
  773.  
  774. Normal mode        In Normal mode you can enter all the editor
  775.             commands.  If you start the editor you are in this
  776.             mode (unless you have set the 'insertmode' option,
  777.             see below).  This is also known as command mode.
  778.  
  779. Visual mode        This is like Normal mode, but the movement commands
  780.             extend a highlighted area.  When a non-movement
  781.             command is used, it is executed for the highlighted
  782.             area.  See |Visual_mode|.
  783.  
  784. Insert mode        In Insert mode the text you type is inserted into the
  785.             buffer.  If the 'showmode' option is on (which is
  786.             default), the string "-- INSERT --" is shown at the
  787.             bottom of the window.  |mode_ins_repl|
  788.  
  789. Command-line mode    In Command-line mode you can enter one line of text
  790.             at the bottom of the window.  This is for the Ex
  791.             commands, ":", the pattern search commands, "?" and
  792.             "/", and the filter command, "!".  |mode_cmdline|
  793.  
  794. There are two ADDITIONAL modes:
  795.  
  796. Replace mode        Replace mode is a special case of Insert mode.  You
  797.             can do the same things as in Insert mode, but for
  798.             each character you enter, one character of the existing
  799.             text is deleted.  If the 'showmode' option is on,
  800.             (which is the default), the string "-- REPLACE --" is
  801.             shown at the bottom of the window.  |replace_mode|
  802.  
  803. Insert command mode    Entered when CTRL-O given in Insert mode.  This is
  804.             like Normal mode, but after executing one command Vim
  805.             returns to Insert mode.  The string "-- (insert) --"
  806.             is shown at the bottom of the window.
  807.  
  808. 4.2 Switching from mode to mode                *mode_switching*
  809.  
  810. If for any reason you do not know which mode you are in, you can always get
  811. back to Normal mode by typing <Esc> twice.  You will know you are back in
  812. Normal mode when you see the screen flash or hear the bell after you type
  813. <Esc>.
  814.  
  815. - go from Normal mode to Visual mode by giving one of the commands "vV^V"
  816. - go from Normal mode to Insert mode by giving one of the commands
  817.   "iIaAoOcCsS".
  818. - go from Normal mode to Replace mode with the "R" command (not the "r"
  819.   command!).
  820. - go from Normal mode to Command-line mode with the one of the commands
  821.   ":/?!".
  822.  
  823.                             *i_esc*
  824. - go from Insert or Replace mode to Normal mode with <Esc> (twice in some
  825.   rare cases).
  826. - go from Visual mode to Normal mode by giving a non-movement command, which
  827.   causes the command to be executed, or by hitting <Esc> or 'v', which does
  828.   nothing.
  829. - go from Command-line mode to Normal mode by:
  830.    - hitting <CR> or <NL>, which causes the entered command to be executed
  831.    - deleting the complete line (e.g., with CTRL-U) and giving a final <BS>
  832.    - hitting CTRL-C or <Esc>, which quits the command line without executing
  833.      the command.
  834.   In the last case <Esc> may be the character defined with the 'wildchar'
  835.   option, in which case it will start command line completion.  You can ignore
  836.   that and type <Esc> again.  {Vi: when hitting <Esc> the command line is
  837.   executed.  This is unexpected for most people; therefore it was changed in
  838.   Vim.  But when the <Esc> is part of a mapping, the command line is executed.
  839.   If you want the Vi behaviour also when typing <Esc>, use ":cmap ^V<Esc>
  840.   ^V^M"}
  841.  
  842. - go from Insert mode to Replace mode by hitting <Insert>.
  843. - go from Replace mode to Insert mode by hitting <Insert>.
  844. - go from Visual mode to Command-line mode by hitting ':'.  The line numbers
  845.   of the highlighted area will be inserted in the command line.
  846.  
  847. If the 'insertmode' option is on, editing a file will start in Insert mode.
  848.  
  849.  
  850. 4.3 Insert and Replace mode                *mode_ins_repl*
  851.  
  852. If you are working in a special language mode when inserting text, see the
  853. 'langmap' option, |'langmap'|, on how to avoid switching this mode on and off
  854. all the time.
  855.  
  856. 4.3.1 special keys                    *ins_special_keys*
  857.  
  858. In Insert and Replace mode, the following characters have a special meaning;
  859. other characters are inserted directly.  To insert one of these special
  860. characters into the buffer, precede it with CTRL-V.  To insert a <Nul>
  861. character use "CTRL-V CTRL-@" or "CTRL-V 000".  On some systems, you have to
  862. use "CTRL-V 003" to insert a CTRL-C.
  863.  
  864. char        action
  865. -----------------------------------------------------------------------
  866.                         *i_CTRL-[* *i_<Esc>*
  867. <Esc> or CTRL-[    End insert or Replace mode, go back to Normal mode.  Finish
  868.         abbreviation.
  869.                         *i_CTRL-C*
  870. CTRL-C        Quit insert mode, go back to Normal mode.  Do not check for
  871.         abbreviations.
  872.  
  873.                         *i_CTRL-@*
  874. CTRL-@        Insert previously inserted text and stop insert.  {Vi: only
  875.         when typed as first char, only up to 128 chars}
  876.                         *i_CTRL-A*
  877. CTRL-A        Insert previously inserted text.  {not in Vi}
  878.  
  879.                         *i_CTRL-H* *i_<BS>*
  880. <BS> or CTRL-H    Delete the character before the cursor (see below).
  881.         See |:fixdel| if your <BS> does not do what you want.
  882.         {Vi: does not delete autoindents}
  883.                         *i_<Del>*
  884. <Del>        Delete the character under the cursor.  If the cursor is at
  885.         the end of the line, and the 'backspace' option is non-zero,
  886.         delete the newline; the next line is appended after the
  887.         current one.  See |:fixdel| if your <Del> key does not do what
  888.         you want.  {not in Vi}
  889.                         *i_CTRL-W*
  890. CTRL-W        Delete the word before the cursor (see below).  See the
  891.         section "word motions", |word_motions|, for the definition of
  892.         a word.
  893.                         *i_CTRL-U*
  894. CTRL-U        Delete all entered characters in the current line (see
  895.         below).
  896.  
  897.                         *i_CTRL-I* *i_<Tab>*
  898. <Tab> or CTRL-I Insert a tab.  If the 'expandtab' option is on, the
  899.         equivalent number of spaces is inserted (use CTRL-V <Tab> to
  900.         avoid the expansion).  See also the 'smarttab' option and
  901.         section 4.3.4, |ins_expandtab|.
  902.                         *i_CTRL-J* *i_<NL>*
  903. <NL> or CTRL-J    Begin new line.
  904.                         *i_CTRL-M* *i_<CR>*
  905. <CR> or CTRL-M    Begin new line.
  906.                         *i_CTRL-K*
  907. CTRL-K {char1} {char2}
  908.         Enter digraph (see 4.7, |digraphs|).  When {char1} is a special
  909.         key, the code for that key is inserted.  Neither char is
  910.         considered for mapping.  {not in Vi}
  911.  
  912. CTRL-N        Find next keyword (see 4.3.6, |i_CTRL-N|).  {not in Vi}
  913. CTRL-P        Find previous keyword (see 4.3.6, |i_CTRL-P|).  {not in Vi}
  914.  
  915. CTRL-R <0-9a-z"%:.->                *i_CTRL-R*
  916.         Insert the contents of register.  Between typing CTRL-R and
  917.         the second character '"' will be displayed to indicate that
  918.         you are expected to enter the name of a register.
  919.         The text is inserted as if you typed it, but mappings and
  920.         abbreviations are not used.  If you have options like
  921.         'textwidth', 'formatoptions', or 'autoindent' set, this will
  922.         influence what will be inserted.  This is different from what
  923.         happens with the "p" command and pasting with the mouse.
  924.         Special registers:
  925.             '"'    the unnamed register, containing the text of
  926.                 the last delete or yank
  927.             '%'    the current file name
  928.             ':'    the last command line
  929.             '.'    the last inserted text
  930.             '-'    the last small (less than a line) delete
  931.         See |registers| about registers.  {not in Vi}
  932.  
  933.                         *i_CTRL-T*
  934. CTRL-T        Insert one shiftwidth of indent at the start of the current
  935.         line.  The indent is always rounded to a 'shiftwidth' (this is
  936.         vi compatible).  {Vi: only when in indent}
  937.                         *i_CTRL-D*
  938. CTRL-D        Delete one shiftwidth of indent at the start of the current
  939.         line.  The indent is always rounded to a 'shiftwidth' (this is
  940.         vi compatible).  {Vi: CTRL-D works only when used after
  941.         autoindent}
  942.                         *i_0_CTRL-D*
  943. 0 CTRL-D    Delete all indent in the current line.  {Vi: CTRL-D works
  944.         only when used after autoindent}
  945.                         *i_^_CTRL-D*
  946. ^ CTRL-D    Delete all indent in the current line.  The indent is
  947.         restored in the next line.  This is useful when inserting a
  948.         label.  {Vi: CTRL-D works only when used after autoindent}
  949.  
  950.                         *i_CTRL-V*
  951. CTRL-V        Insert next non-digit literally.  For special keys, the
  952.         terminal code is inserted.  Up to three digits form the
  953.         decimal value of a single byte (see below |i_CTRL-V_digit|.
  954.         The non-digit and the three digits are not considered for
  955.         mapping.  {Vi: no decimal byte entry}
  956.  
  957.                         *i_CTRL-Q*
  958. CTRL-Q        Same as CTRL-V.
  959.  
  960. CTRL-X        Enter CTRL-X mode.  This is a sub-mode where commands can
  961.         be given to complete words or scroll the window. See below,
  962.         |i_CTRL-X|, and in 4.3.6, |ins_completion|. {not in Vi}
  963.  
  964.                         *i_CTRL-E*
  965. CTRL-E        Insert the character which is below the cursor.  {not in Vi}
  966.                         *i_CTRL-Y*
  967. CTRL-Y        Insert the character which is above the cursor.  {not in Vi}
  968.  
  969.                         *i_CTRL-B*
  970. CTRL-B        Toggle the 'revins' option (B for Backwards).  Only if
  971.         compiled with RIGHTLEFT (which is not the default).  See
  972.         |ins_reverse|.  {not in Vi}
  973.                         *i_CTRL-_*
  974. CTRL-_        This key is only available if Vim was compiled with RIGHTLEFT.
  975.         Its purpose is to switch between languages while in insert
  976.         mode, as follows:
  977.         -  When in a rightleft window, revins and nohkmap are toggled,
  978.            since English will likely be inserted in this case.
  979.         -  When in a norightleft window, revins and hkmap are toggled,
  980.            since Hebrew will likely be inserted in this case.
  981.  
  982.         CTRL-_ moves the cursor to the end of the typed text, unlike
  983.         CTRL-B which leaves the cursor in the same place.
  984.  
  985.         Please refer to |vim_rlh.txt| for more information about
  986.         right-to-left mode.  {not in Vi}
  987.  
  988.                         *i_<Insert>*
  989. <Insert>    Toggle between insert and replace mode.  {not in Vi}
  990. -----------------------------------------------------------------------
  991.  
  992. The effect of the <BS>, CTRL-W, and CTRL-U depend on the 'backspace' option
  993. (unless 'revins' is set):
  994.  
  995. backspace    action
  996.  option
  997.    0       delete stops in column 1 and start position of insert
  998.    1       delete stops at start position of insert
  999.    2       delete always; CTRL-W and CTRL-U stop once at start position of
  1000.        insert
  1001.  
  1002. If the 'backspace' option is non-zero and the cursor is in column 1 when one
  1003. of the three keys is used, the current line is joined with the previous
  1004. line.  This effectively deletes the newline in front of the cursor.  {Vi: does
  1005. not cross lines, does not delete past start position of insert}
  1006.  
  1007.                         *i_CTRL-V_digit*
  1008. With CTRL-V followed by one, two, or three digits, you can enter the decimal
  1009. value of any byte, except 10.  Normally CTRL-V is followed by three digits.
  1010. The formed byte is inserted as soon as you type the third digit.  If you type
  1011. only one or two digits and then a non-digit, the decimal value of those one
  1012. or two digits form the byte.  After that the non-digit is dealt with in the
  1013. normal way.  If you enter a value of 10, it will end up in the file as a 0.
  1014. The 10 is a <NL>, which is used internally to represent the <Nul> character.
  1015. When writing the buffer to a file, the <NL> character is translated into
  1016. <Nul>.  The <NL> character is written at the end of each line.  Thus if you
  1017. want to insert a <NL> character in a file you will have to make a line
  1018. break.  The maximum value that can be entered is 255.
  1019.  
  1020.                         *i_CTRL-X* *insert_expand*
  1021. CTRL-X enters a sub-mode where several commands can be used.  Most of these
  1022. commands do keyword completion; see 4.3.6, |ins_completion|.  These are only
  1023. available when Vim was compiled with INSERT_EXPAND defined.  If ":version"
  1024. shows "+insert_expand" then it was; if it shows "-insert_expand" then these
  1025. commands are not available.  Two commands can be used to scroll the window up
  1026. or down, without exiting insert mode:
  1027.  
  1028.                         *i_CTRL-X_CTRL-E*
  1029. CTRL-X CTRL-E        scroll window one line up.
  1030.  
  1031.                         *i_CTRL-X_CTRL-Y*
  1032. CTRL-X CTRL-Y        scroll window one line down.
  1033.  
  1034. After CTRL-X is pressed, each CTRL-E (CTRL-Y) scrolls the window up (down) by
  1035. one line unless that would cause the cursor to move from its current position
  1036. in the file.  As soon as another key is pressed, CTRL-X mode is exited and
  1037. that key is interpreted as in Insert mode.
  1038.  
  1039.  
  1040. 4.3.2 special special keys                *ins_special_special*
  1041.  
  1042. The following keys are special.  They stop the current insert, do something,
  1043. and then restart insertion.  This means you can do something without getting
  1044. out of Insert mode.  This is very handy if you prefer to use the Insert mode
  1045. all the time, just like editors that don't have a separate Normal mode.  You
  1046. may also want to set the 'backspace' option to 2 and set the 'insertmode'
  1047. option.  You can use CTRL-O if you want to map a function key to a command.
  1048.  
  1049. The changes (inserted or deleted characters) before and after these keys can
  1050. be undone separately.  Only the last change can be redone and always behaves
  1051. like an "i" command.
  1052.  
  1053. char        action
  1054. -----------------------------------------------------------------------
  1055. <Up>        cursor one line up                 *i_<Up>*
  1056. <Down>        cursor one line down                 *i_<Down>*
  1057. <Left>        cursor one character left             *i_<Left>*
  1058. <Right>        cursor one character right             *i_<Right>*
  1059. <S-Left>    cursor one word back (like "b" command)         *i_<S-Left>*
  1060. <S-Right>    cursor one word forward (like "w" command)   *i_<S-Right>*
  1061. <Home>        cursor to first char in the line         *i_<Home>*
  1062. <End>        cursor to after last char in the line         *i_<End>*
  1063. <C-Home>    cursor to first char in the file         *i_<C-Home>*
  1064. <C-End>        cursor to after last char in the file         *i_<C-End>*
  1065. <LeftMouse>    cursor to position of mouse click         *i_<LeftMouse>*
  1066. <S-Up>        move window one page up                 *i_<S-Up>*
  1067. <PageUp>    move window one page up                 *i_<PageUp>*
  1068. <S-Down>    move window one page down             *i_<S-Down>*
  1069. <PageDown>    move window one page down             *i_<PageDown>*
  1070. CTRL-O        execute one command and return to Insert mode*i_CTRL-O*
  1071. -----------------------------------------------------------------------
  1072.  
  1073. The CTRL-O command sometimes has one side effect: If the cursor was beyond the
  1074. end of the line, it will be put on the last character in the line.
  1075. The shifted cursor keys are not available on all terminals.
  1076.  
  1077. When the 'whichwrap' option is set appropriately, the <Left> and <Right>
  1078. keys on the first/last character in the line make the cursor wrap to the
  1079. previous/next line.
  1080.  
  1081.  
  1082. 4.3.3 'textwidth' and 'wrapmargin' options        *ins_textwidth*
  1083.  
  1084. The 'textwidth' option can be used to automatically break a line before it
  1085. gets too long.  Set the 'textwidth' option to the desired maximum line
  1086. length.  If you then type more characters (not spaces or tabs), the
  1087. last word will be put on a new line (unless it is the only word on the
  1088. line).  If you set 'textwidth' to 0, this feature is disabled.
  1089.  
  1090. The 'wrapmargin' option does almost the same.  The difference is that
  1091. 'textwidth' has a fixed width while 'wrapmargin' depends on the width of the
  1092. screen.  When using 'wrapmargin' this is equal to using 'textwidth' with a
  1093. value equal to (columns - 'wrapmargin'), where columns is the width of the
  1094. screen.
  1095.  
  1096. When 'textwidth' and 'wrapmargin' are both set, 'textwidth' is used.
  1097.  
  1098. The line is only broken automatically when using insert mode, or when
  1099. appending to a line.  When in replace mode and the line length is not
  1100. changed, the line will not be broken.
  1101.  
  1102. Long lines are broken if you enter a non-white character after the margin.
  1103. The situations where a line will be broken can be restricted by adding
  1104. characters to the 'formatoptions' option:
  1105. "l"  Only break a line if it was not longer than 'textwidth' when the insert
  1106.      started.
  1107. "v"  Only break at a white character that has been entered during the
  1108.      current insert command.  This is mostly Vi-compatible.
  1109. "lv" Only break if the line was not longer than 'textwidth' when the insert
  1110.      started and only at a white character that has been entered during the
  1111.      current insert command.  Only differs from "l" when entering non-white
  1112.      characters while crossing the 'textwidth' boundary.
  1113.  
  1114. If you want to format a block of text, you can use the "gq" operator.  Type
  1115. "gq" and a movement command to move the cursor to the end of the block.  In
  1116. many cases, the command "gq}" will do what you want (format until the end of
  1117. paragraph).  Alternatively, you can use "gqp", which will format the whole
  1118. paragraph, no matter where the cursor currently is.  Or you can use Visual
  1119. mode: hit "v", move to the end of the block, and hit "gq".  See also |gq|.
  1120.  
  1121.  
  1122. 4.3.4 'expandtab' and 'smarttab' options        *ins_expandtab*
  1123.  
  1124. If the 'expandtab' option is on, spaces will be used to fill the amount of
  1125. whitespace of the tab.  If you want to enter a real <Tab>, type CTRL-V first.
  1126. The 'expandtab' option is off by default.  Note that in Replace mode, a single
  1127. character is replaced with several spaces.  The result of this is that the
  1128. number of characters in the line increases.  Backspacing will delete one
  1129. space at a time.  The original character will be put back for only one space
  1130. that you backspace over (the last one).  {Vi does not have the 'expandtab'
  1131. option}
  1132.  
  1133.                             *ins_smarttab*
  1134. When the 'smarttab' option is on, a <Tab> inserts 'shiftwidth' positions at
  1135. the beginning of a line and 'tabstop' positions in other places.  This means
  1136. that often spaces instead of a <Tab> character are inserted.  When 'smarttab
  1137. is off, a <Tab> always inserts 'tabstop' positions, and 'shiftwidth' is only
  1138. used for ">>" and the like.  {not in Vi}
  1139.  
  1140.  
  1141. 4.3.5 Replace mode                    *replace_mode*
  1142.  
  1143. In Replace mode, one character in the line is deleted for every character you
  1144. type.  If there is no character to delete (at the end of the line), the
  1145. typed character is appended (as in Insert mode).  Thus the number of
  1146. characters in a line stays the same until you get to the end of the line.
  1147. If a <NL> is typed, a line break is inserted and no character is deleted.
  1148.  
  1149. Be careful with <Tab> characters.  If you type a normal printing character in
  1150. its place, the number of characters is still the same, but the number of
  1151. columns will become smaller.
  1152.  
  1153. If you delete characters in Replace mode (with <BS>, CTRL-W, or CTRL-U), what
  1154. happens is that you delete the changes.  The characters that were replaced
  1155. are restored.  If you had typed past the existing text, the characters you
  1156. added are deleted.  This is effectively a character-at-a-time undo.
  1157.  
  1158. If the 'expandtab' option is on, a <Tab> will replace one character with
  1159. several spaces.  The result of this is that the number of characters in the
  1160. line increases.  Backspacing will delete one space at a time.  The original
  1161. character will be put back for only one space that you backspace over (the
  1162. last one).  {Vi does not have the 'expandtab' option}
  1163.  
  1164.  
  1165. 4.3.6 Insert mode completion                *ins_completion*
  1166.  
  1167. In Insert and Replace modes, there are several commands to complete part of a
  1168. keyword or line that has been typed.  This is useful if you are using
  1169. complicated keywords (e.g., function names with capitals and underscores).
  1170. Completion can be done for:
  1171.  
  1172. 1. Whole lines                        |i_CTRL-X_CTRL-L|
  1173. 2. keywords in the current file                |i_CTRL-N|
  1174. 3. keywords in 'dictionary'                |i_CTRL-X_CTRL-K|
  1175. 4. keywords in the current and included files        |i_CTRL-X_CTRL-I|
  1176. 5. tags                            |i_CTRL-X_CTRL-]|
  1177. 6. file names                        |i_CTRL-X_CTRL-F|
  1178. 7. definitions or macros                |i_CTRL-X_CTRL-D|
  1179.  
  1180. All these (except 2) are done in CTRL-X mode.  This is a sub-mode of Insert
  1181. and Replace modes.  You enter CTRL-X mode by typing CTRL-X and one of the
  1182. CTRL-X commands.  You exit CTRL-X mode by typing a key that is not a valid
  1183. CTRL-X mode command.  Valid keys are the CTRL-X command itself, CTRL-N (next),
  1184. and CTRL-P (previous).
  1185.  
  1186. Also see the 'infercase' option if you want to adjust the case of the match.
  1187.  
  1188. Note: The keys that are valid in CTRL-X mode are not mapped.  This allows for
  1189. ":map ^F ^X^F" to work (where ^F is CTRL-F and ^X is CTRL-X).  The key that
  1190. ends CTRL-X mode (any key that is not a valid CTRL-X mode command) is mapped.
  1191.  
  1192. The following mappings are suggested to make typing the completion commands
  1193. a bit easier (although they will hide other commands):
  1194.     :inoremap ^] ^X^]
  1195.     :inoremap ^F ^X^F
  1196.     :inoremap ^D ^X^D
  1197.     :inoremap ^L ^X^L
  1198.  
  1199.  
  1200. Completing whole lines                    *compl_whole_line*
  1201.  
  1202.                             *i_CTRL-X_CTRL-L*
  1203. CTRL-X CTRL-L        Search backwards for a line that starts with the
  1204.             same characters as in the current line before the
  1205.             cursor.  Indent is ignored.  The found line is
  1206.             inserted in front of the cursor.
  1207.     CTRL-L    or
  1208.     CTRL-P        Search backwards for next matching line.  This line
  1209.             replaces the previous matching line.
  1210.  
  1211.     CTRL-N        Search forward for next matching line.  This line
  1212.             replaces the previous matching line.
  1213.  
  1214. Completing keywords in current file            *compl_current*
  1215.  
  1216.                             *i_CTRL-P*
  1217.                             *i_CTRL-N*
  1218. The keys CTRL-N and CTRL-P can be used to complete the keyword that is in
  1219. front of the cursor.  This is useful if you are writing a program that has
  1220. complicated variable names, and you want to copy a name from the text before
  1221. or after the cursor.
  1222.  
  1223. If there is a keyword in front of the cursor (a name made out of alphabetic
  1224. characters and characters in 'iskeyword'), it is used as the search pattern,
  1225. with "\<" prepended (meaning: start of a word).  Otherwise "\<\k\k" is used
  1226. as search pattern (start of any keyword of at least two characters).
  1227.  
  1228. With CTRL-N (next), the search goes forward; with CTRL-P (previous), the
  1229. search goes backward.  The first time the search starts where the cursor is.
  1230. Subsequently, the search starts at the last found position.  If you type any
  1231. other character than CTRL-P or CTRL-N, the current text is accepted and the
  1232. search pattern is forgotten.
  1233.  
  1234. If the search found a match, it is inserted at the cursor position.  Any
  1235. previous match is replaced.  If no match was found, Vim will beep.
  1236.  
  1237. In Replace mode, the number of characters that are replaced depends on the
  1238. length of the matched string.  This works like typing the characters of the
  1239. matched string in Replace mode.
  1240.  
  1241. If there is not a valid keyword character before the cursor, any keyword of
  1242. at least two characters is matched.
  1243.     e.g., to get:
  1244.         printf("(%g, %g, %g)", vector[0], vector[1], vector[2]);
  1245.     just type:
  1246.         printf("(%g, %g, %g)", vector[0], ^P[1], ^P[2]);
  1247.  
  1248. Multiple repeats of the same completion are skipped; thus a different match
  1249. will be inserted at each CTRL-N and CTRL-P (unless there is only one
  1250. matching keyword).
  1251.  
  1252. If there is only one completion found, then a second CTRL-P or CTRL-N will
  1253. give the message 'No other matches'.
  1254.  
  1255. If the only match in the file is an exact match, where no extra characters
  1256. would be typed, then the message 'Exact match only' is given (this is also
  1257. useful for checking that you typed the word correctly).
  1258.  
  1259. The mode (-- INSERT --) is shown, unless there is another more important
  1260. message (e.g., "Pattern not found").  This other message will stay until
  1261. another key is hit, and then the mode is shown again.
  1262.  
  1263. Single character matches are never included, as they usually just get in
  1264. the way of what you were really after.
  1265.     e.g., to get:
  1266.         printf("name = %s\n", name);
  1267.     just type:
  1268.         printf("name = %s\n", n^P);
  1269.     or even:
  1270.         printf("name = %s\n", ^P);
  1271. The 'n' in '\n' is skipped.
  1272.  
  1273.  
  1274. Completing keywords in 'dictionary'            *compl_dictionary*
  1275.  
  1276.                             *i_CTRL-X_CTRL-K*
  1277. CTRL-X CTRL-K        Search the files given with the 'dictionary' option
  1278.             for words that start with the keyword in front of the
  1279.             cursor.  This is like CTRL-N, but only the dictionary
  1280.             files are searched, not the current file.  The found
  1281.             keyword is inserted in front of the cursor.  This
  1282.             could potentially be pretty slow, since all matches
  1283.             are found before the first match is used.  By default,
  1284.             the 'dictionary' option is empty.
  1285.  
  1286.     CTRL-K    or
  1287.     CTRL-N        Search forward for next matching keyword.  This
  1288.             keyword replaces the previous matching keyword.
  1289.  
  1290.     CTRL-P        Search backwards for next matching keyword.  This
  1291.             keyword replaces the previous matching keyword.
  1292.  
  1293.  
  1294. Completing keywords in the current and included files    *compl_keyword*
  1295.  
  1296. The 'include' option is used to specify a line that contains an include file
  1297. name.  The 'path' option is used to search for include files.
  1298.  
  1299.                             *i_CTRL-X_CTRL-I*
  1300. CTRL-X CTRL-I        Search for the first keyword in the current and
  1301.             included files that starts with the same characters
  1302.             as those before the cursor.  The matched keyword is
  1303.             inserted in front of the cursor.
  1304.  
  1305.     CTRL-N        Search forwards for next matching keyword.  This
  1306.             keyword replaces the previous matching keyword.
  1307.             Note: CTRL-I is the same as <Tab>, which is likely to
  1308.             be typed after a succesful completion, therefore
  1309.             CTRL-I is not used for searching for the next match.
  1310.  
  1311.     CTRL-P        Search backward for previous matching keyword.  This
  1312.             keyword replaces the previous matching keyword.
  1313.  
  1314.  
  1315. Completing tags                        *compl_tag*
  1316.                             *i_CTRL-X_CTRL-]*
  1317. CTRL-X CTRL-]        Search for the first tag that starts with the same
  1318.             characters as before the cursor.  The matching tag is
  1319.             inserted in front of the cursor.  Alphabetic
  1320.             characters and characters in 'iskeyword' are used
  1321.             to decide which characters are included in the tag
  1322.             name (same as for a keyword).
  1323.     CTRL-]    or
  1324.     CTRL-N        Search forwards for next matching tag.  This tag
  1325.             replaces the previous matching tag.
  1326.  
  1327.     CTRL-P        Search backward for previous matching tag.  This tag
  1328.             replaces the previous matching tag.
  1329.  
  1330.  
  1331. Completing file names                    *compl_filename*
  1332.                             *i_CTRL-X_CTRL-F*
  1333. CTRL-X CTRL-F        Search for the first file name that starts with the
  1334.             same characters as before the cursor.  The matching
  1335.             file name is inserted in front of the cursor.
  1336.             Alphabetic characters and characters in 'isfname'
  1337.             are used to decide which characters are included in
  1338.             the file name.  Note: the 'path' option is not used
  1339.             here (yet).
  1340.     CTRL-F    or
  1341.     CTRL-N        Search forwards for next matching file name.  This
  1342.             file name replaces the previous matching file name.
  1343.  
  1344.     CTRL-P        Search backward for previous matching file name.
  1345.             This file name replaces the previous matching file
  1346.             name.
  1347.  
  1348.  
  1349. Completing definitions or macros            *compl_define*
  1350.  
  1351. The 'define' option is used to specify a line that contains a definition.
  1352. The 'include' option is used to specify a line that contains an include file
  1353. name.  The 'path' option is used to search for include files.
  1354.  
  1355.                             *i_CTRL-X_CTRL-D*
  1356. CTRL-X CTRL-D        Search in the current and included files for the
  1357.             first definition (or macro) name that starts with
  1358.             the same characters as before the cursor.  The found
  1359.             definition name is inserted in front of the cursor.
  1360.     CTRL-D    or
  1361.     CTRL-N        Search forwards for next matching macro name.  This
  1362.             macro name replaces the previous matching macro
  1363.             name.
  1364.  
  1365.     CTRL-P        Search backward for previous matching macro name.
  1366.             This macro name replaces the previous matching macro
  1367.             name.
  1368.  
  1369.  
  1370. 4.4 Command-line mode                    *mode_cmdline* *:*
  1371.  
  1372. Command-line mode is used to enter Ex commands (":"), search patterns
  1373. ("/" and "?"), and filter commands ("!").
  1374.  
  1375.  
  1376. 4.4.1 Command line editing                *cmdline_editing*
  1377.  
  1378. Normally characters are inserted in front of the cursor position.  You can
  1379. move around in the command line with the left and right cursor keys.  With the
  1380. <Insert> key, you can toggle between inserting and overstriking characters.
  1381. {Vi: can only alter the last character in the line}
  1382.  
  1383. Note that if your keyboard does not have working cursor keys or any of the
  1384. other special keys, you can use ":cnoremap" to define another key for them.
  1385. For example, to define tcsh style editing keys:        *tcsh-style*
  1386.     :cnoremap <C-A> <Home>
  1387.     :cnoremap <C-F> <Right>
  1388.     :cnoremap <C-B> <Left>
  1389.     :cnoremap <Esc>b <S-Left>
  1390.     :cnoremap <Esc>f <S-Right>
  1391. (<> notation |<>|; type all this literally)
  1392.  
  1393.                             *cmdline_history*
  1394. The command lines that you enter are remembered in a history table.  You can
  1395. recall them with the up and down cursor keys.  There are actually two history
  1396. tables: one for ':' commands, one for search strings.  These are completely
  1397. separate.  The search strings history can be accessed only when entering a
  1398. search string, the ':' history only when entering a command line for the ":"
  1399. command.  Use the 'history' option to set the number of lines that are
  1400. remembered (default: 20).  Note that when you enter a command line that is
  1401. excactly the same as an older one, the old one is removed (to avoid repeated
  1402. commands moving older commands out of the history).  Only commands that are
  1403. typed are remembered.  Ones that come from mappings are not put in the history
  1404. (detail: the decision is made from the last key that was typed for the line,
  1405. normally <CR>).  All searches are put in the search history, including the ones
  1406. that come from commands like "*" and "#".  {Vi: no history}
  1407.  
  1408. There is an automatic completion of names on the command line; see 4.4.2,
  1409. |cmdline_completion|.
  1410.  
  1411.                             *c_CTRL-V*
  1412. CTRL-V        Insert next non-digit literally.  Up to three digits form the
  1413.         decimal value of a single byte.  The non-digit and the three
  1414.         digits are not considered for mapping.  This works the same
  1415.         way as in Insert mode (see above, |i_CTRL-V|).
  1416.                             *c_CTRL-Q*
  1417. CTRL-Q        Same as CTRL-V.
  1418.  
  1419.                             *c_<Left>*
  1420. <Left>        cursor left
  1421.                             *c_<Right>*
  1422. <Right>        cursor right
  1423.                             *c_<S-Left>*
  1424. <S-Left>    cursor one word left
  1425.                             *c_<S-Right>*
  1426. <S-Right>    cursor one word right
  1427. CTRL-B or <Home>                    *c_CTRL-B* *c_<Home>*
  1428.         cursor to beginning of command line
  1429. CTRL-E or <End>                        *c_CTRL-E* *c_<End>*
  1430.         cursor to end of command line
  1431.  
  1432.                             *c_<LeftMouse>*
  1433. <LeftMouse>    cursor to position of mouse click.
  1434.  
  1435. CTRL-H                            *c_<BS>* *c_CTRL-H*
  1436. <BS>        delete the character in front of the cursor (see |:fixdel| if
  1437.         your <BS> key does not do what you want).
  1438.                             *c_<Del>*
  1439. <Del>        delete the character under the cursor (at end of line:
  1440.         character before the cursor) (see |:fixdel| if your <Del>
  1441.         key does not do what you want).
  1442.                             *c_CTRL-W*
  1443. CTRL-W        delete the word before the cursor
  1444.                             *c_CTRL-U*
  1445. CTRL-U        remove all characters
  1446.  
  1447.         Note: if the command line becomes empty with one of the
  1448.         delete commands, Command-line mode is quit.
  1449.                             *c_<Insert>*
  1450. <Insert>    Toggle between insert and overstrike.  {not in Vi}
  1451.  
  1452. {char1} <BS> {char2}    or                *c_digraph*
  1453. CTRL-K {char1} {char2}                    *c_CTRL-K*
  1454.         enter digraph (see 4.7, |digraphs|).  When {char1} is a special
  1455.         key, the code for that key is inserted.  {not in Vi}
  1456.  
  1457. CTRL-R <0-9a-z"%:->                    *c_CTRL-R*
  1458.         Insert the contents of a numbered or named register.  Between
  1459.         typing CTRL-R and the second character '"' will be displayed
  1460.         to indicate that you are expected to enter the name of a
  1461.         register.  The text is inserted as if you typed it, but
  1462.         mappings and abbreviations are not used.  Special registers:
  1463.             '"'    the unnamed register, containing the text of
  1464.                 the last delete or yank
  1465.             '%'    the current file name
  1466.             ':'    the last command line
  1467.             '-'    the last small (less than a line) delete
  1468.         Note: The '.' register (last inserted text) is not available
  1469.         here.  See |registers| about registers.  {not in Vi}
  1470.  
  1471. CTRL-J                        *c_CTRL-J* *c_<NL>* *c_<CR>*
  1472. <CR> or <NL>    start entered command
  1473.                             *c_<Esc>*
  1474. <Esc>        When typed and 'x' not present in 'cpoptions', quit
  1475.         Command-line mode without executing.  In macros or when 'x'
  1476.         present in 'cpoptions', start entered command.
  1477.                             *c_CTRL-C*
  1478. CTRL-C        quit command line without executing
  1479.  
  1480.                             *c_<Up>*
  1481. <Up>        recall older command line from history, whose beginning
  1482.         matches the current command line (see below).
  1483.                             *c_<Down>*
  1484. <Down>        recall more recent command line from history, whose beginning
  1485.         matches the current command line (see below).
  1486.  
  1487.                             *c_<S-Up>* *c_<PageUp>*
  1488. <S-Up> or <PageUp>
  1489.         recall older command line from history
  1490.                         *c_<S-Down>* *c_<PageDown>*
  1491. <S-Down> or <PageDown>
  1492.         recall more recent command line from history
  1493.  
  1494. CTRL-D        command line completion (see 4.4.2, |cmdline_completion|)
  1495. 'wildchar' option
  1496.         command line completion (see 4.4.2, |cmdline_completion|)
  1497. CTRL-N        command line completion (see 4.4.2, |cmdline_completion|)
  1498. CTRL-P        command line completion (see 4.4.2, |cmdline_completion|)
  1499. CTRL-A        command line completion (see 4.4.2, |cmdline_completion|)
  1500. CTRL-L        command line completion (see 4.4.2, |cmdline_completion|)
  1501.  
  1502.                             *c_CTRL-_*
  1503. CTRL-_        switch between Hebrew and English keyboard mode, which is
  1504.         private to the command line and not related to hkmap.
  1505.         This is useful when Hebrew text entry is required in the
  1506.         command line, searches, abbreviations, etc.  Applies only if
  1507.         Vim is compiled with RIGHTLEFT.  See |vim_rlh.txt|.
  1508.  
  1509. The <Up> and <Down> keys take the current command line as a search string.
  1510. The beginning of the next/previous command lines are compared with this
  1511. string.  The first line that matches is the new command line.  When typing
  1512. these two keys repeatedly, the same string is used again.  For example, this
  1513. can be used to find the previous substitute command: Type ":s" and then <Up>.
  1514. The same could be done by typing <S-Up> a number of times until the desired
  1515. command line is shown.  (Note: the shifted arrow keys do not work on all
  1516. terminals)
  1517.  
  1518.  
  1519. 4.4.2 Command line completion                *cmdline_completion*
  1520.  
  1521. When editing the command line, a few commands can be used to complete the
  1522. word before the cursor.  This is available for:
  1523.  
  1524. - Command names: at the start of the command line.  Works always.
  1525. - tags: only after the ":tag" command.
  1526. - file names: only after a command that accepts a file name or a setting for
  1527.   an option that can be set to a file name.  This is called file name
  1528.   completion.
  1529. - options: only after the ":set" command.
  1530.  
  1531. These are the commands that can be used:
  1532.  
  1533.                             *c_CTRL-D*
  1534. CTRL-D        List names that match the pattern in front of the cursor.
  1535.         When showing file names, directories are highlighted (see
  1536.         'highlight' option)
  1537.                     *c_CTRL-I* *c_wildchar* *c_<Tab>*
  1538. 'wildchar' option
  1539.         A match is done on the pattern in front of the cursor.  The
  1540.         match (if there are several, the first match) is inserted
  1541.         in place of the pattern.  (Note: does not work inside a
  1542.         macro, because <Tab> or <Esc> are mostly used as 'wildchar',
  1543.         and these have a special meaning in some macros.) When typed
  1544.         again and there were multiple matches, the next
  1545.         match is inserted.  After the last match, the first is used
  1546.         again (wrap around).
  1547.                             *c_CTRL-N*
  1548. CTRL-N        After using 'wildchar' which got multiple matches, go to next
  1549.         match.  Otherwise recall more recent command line from history.
  1550. <S-Tab>                            *c_CTRL-P* *c_<S-Tab>*
  1551. CTRL-P        After using 'wildchar' which got multiple matches, go to
  1552.         previous match.  Otherwise recall older command line from
  1553.         history.  <S-Tab> only works with the GUI, on the Amiga and
  1554.         with MS-DOS.
  1555.                             *c_CTRL-A*
  1556. CTRL-A        All names that match the pattern in front of the cursor are
  1557.         inserted.
  1558.                             *c_CTRL-L*
  1559. CTRL-L        A match is done on the pattern in front of the cursor.  If
  1560.         there is one match, it is inserted in place of the pattern.
  1561.         If there are multiple matches the longest common part is
  1562.         inserted in place of the pattern.
  1563.  
  1564. The 'wildchar' option defaults to <Tab> (CTRL-E when compiled with
  1565. COMPATIBLE; in a previous version <Esc> was used).  In the pattern standard
  1566. wildcards '*' and '?' are accepted.  '*' matches any string, '?' matches
  1567. exactly one character.
  1568.  
  1569. If you like tcsh's autolist completion, you can use this mapping:
  1570.     :cnoremap X <C-L><C-D>
  1571. (Where X is the command key to use, <C-L> is CTRL-L and <C-D> is CTRL-L)
  1572. This will find the longest match and then list all matching files.
  1573.  
  1574.                             *suffixes*
  1575. For filename completion you can use the 'suffixes' option to set a priority
  1576. between files with almost the same name.  If there are multiple matches,
  1577. those files with an extension that is in the 'suffixes' option are ignored.
  1578. The default is ".bak,~,.o,.h,.info,.swp", which means that files ending in
  1579. ".bak", "~", ".o", ".h", ".info" and ".swp" are sometimes ignored.  It is
  1580. impossible to ignore suffixes with two dots.  Examples:
  1581.  
  1582. pattern:    files:                match:
  1583. test*        test.c test.h test.o        test.c
  1584. test*        test.h test.o            test.h and test.o
  1585. test*        test.i test.h test.c        test.i and test.c
  1586.  
  1587. If there is more than one matching file (after ignoring the ones matching
  1588. the 'suffixes' option) the first file name is inserted.  You can see that
  1589. there is only one match when you type 'wildchar' twice and the completed
  1590. match stays the same.  You can get to the other matches by entering
  1591. 'wildchar', CTRL-N or CTRL-P.  All files are included, also the ones with
  1592. extensions matching the 'suffixes' option.
  1593.  
  1594. The old value of an option can be obtained by hitting 'wildchar' just after
  1595. the '='.  For example, typing 'wildchar' after ":set dir=" will insert the
  1596. current value of 'dir'.  This overrules filename completion for the options
  1597. that take a file name.
  1598.  
  1599. If you would like using <S-Tab> for CTRL-P in an xterm, put this command in
  1600. your .cshrc:
  1601.     xmodmap -e "keysym Tab = Tab Find"
  1602. And this in your .vimrc:
  1603.     cmap <Esc>[1~ <C-P>        (<C-P> is CTRL-P)
  1604.  
  1605.  
  1606. 4.4.3 Ex command lines                    *cmdline_lines*
  1607.  
  1608. The Ex commands have a few specialties:
  1609.  
  1610.                             *:quote*
  1611. '"' at the start of a line causes the whole line to be ignored.  '"'
  1612. after a command causes the rest of the line to be ignored.  This can be used
  1613. to add comments.  Example:
  1614.     :set ai        "set 'autoindent' option
  1615. It is not possible to add a comment to a shell command ":!cmd" or to the
  1616. ":map" command and friends, because they see the '"' as part of their
  1617. argument.
  1618.  
  1619.                             *:bar*
  1620. '|' can be used to separate commands, so you can give multiple commands in one
  1621. line.  The commands ":global", "vglobal", ":!", ":r !", ":w !", ":help" and
  1622. ":autocmd" see the '|' as their argument, and can therefore not be followed by
  1623. another command.  If you want '|' to be included in one of the other commands,
  1624. precede it with '\'.  Note that this is confusing (inherited from Vi).   With
  1625. ":g" the '|' is included in the command, with ":s" it is not.
  1626.  
  1627. There is one exception: When the 'b' flag is present in 'cpoptions', with the
  1628. ":map" and ":abbr" commands and friends CTRL-V needs to be used instead of
  1629. '\'.  You can also use "<Bar>" instead.  See also |map_bar|.
  1630.  
  1631. Examples:
  1632.     :!ls | wc        view the output of two commands
  1633.     :r !ls | wc        insert the same output in the text
  1634.     :%g/foo/p|>        moves all matching lines one shiftwidth
  1635.     :%s/foo/bar/|>        moves one line one shiftwidth
  1636.     :map q 10^V|        map "q" to "10|"
  1637.     :map q 10\| map \ l    map "q" to "10\" and map "\" to "l"
  1638.                     (when 'b' is present in 'cpoptions')
  1639.  
  1640. You can also use <NL> to separate commands in the same way as with '|'.  To
  1641. insert a <NL> use CTRL-V CTRL-J.  "^@" will be shown.  Using '|' is the
  1642. preferred method.  But for external commands a <NL> must be used, because a
  1643. '|' is included in the external command.  To avoid the special meaning of <NL>
  1644. it must be preceded with a backslash.  Example:
  1645.     :r !date<NL>-join
  1646. This reads the current date into the file and joins it with the previous line.
  1647.  
  1648. Because of vi compatibility the following strange commands are supported:
  1649.     :|            print current line (like ":p")
  1650.     :3|            print line 3 (like ":3p")
  1651.     :3            goto line 3
  1652.  
  1653. A colon is allowed between the range and the command name.  It is ignored
  1654. (this is vi compatible).  For example ":1,$:s/pat/string".
  1655.  
  1656. When the character '%' or '#' is used where a filename is expected, they are
  1657. expanded to the current and alternate filename (see the chapter "editing
  1658. files" |:_%| |:_#|).
  1659.  
  1660. Embedded spaces in filenames are allowed on the Amiga if one filename is
  1661. expected as argument.  Trailing spaces will be ignored, unless escaped with a
  1662. backslash or CTRL-V.  Note that the ":next" command uses spaces to separate
  1663. file names.  Escape the spaces to include them in a file name.  Example:
  1664.     :next foo\ bar goes\ to school\
  1665. starts editing the three files "foo bar", "goes to" and "school ".
  1666.  
  1667. When you want to use the special characters '"' or '|' in a command, or want
  1668. to use '%' or '#' in a filename, precede them with a backslash.  The backslash
  1669. is not required in a range and in the ":substitute" command.
  1670.  
  1671.                             *:_!*
  1672. The '!' (bang) character after an Ex command makes the command behave in a
  1673. different way.  The '!' should be placed immediately after the command, without
  1674. any blanks in between.  If you insert blanks the '!' will be seen as an
  1675. argument for the command, which has a different meaning.  For example:
  1676.     :w! name    write the current buffer to file "name", overwriting
  1677.             any existing file
  1678.     :w !name    send the current buffer as standard input to command
  1679.             "name"
  1680.  
  1681.  
  1682. 4.4.4 Ex command line ranges                *cmdline_ranges*
  1683.  
  1684. Some Ex commands accept a line range in front of them.  This is noted as
  1685. [range].  It consists of one or more line specifiers, separated with ',' or
  1686. ';'.  When separated with ';' the cursor position will be set to that line
  1687. before interpreting the next line specifier.  The default line specifier for
  1688. most commands is the cursor position, but the commands ":write" and
  1689. ":global" have the whole file (1,$) as default.  If more line specifiers are
  1690. given than required for the command, the first one(s) will be ignored.
  1691.  
  1692. Line numbers may be specified with:            *:range*
  1693.     {number}    an absolute line number
  1694.     .        the current line              *:.*
  1695.     $        the last line in the file          *:$*
  1696.     %        equal to 1,$ (the entire file)          *:%*
  1697.     *        equal to '<,'> (the Visual area)      *:star*
  1698.     't        position of mark t (lower case)          *:'*
  1699.     /{pattern}[/]    the next line where {pattern} matches      *:/*
  1700.     ?{pattern}[?]    the previous line where {pattern} matches *:?*
  1701.     \/        the next line where the previously used search
  1702.             pattern matches
  1703.     \?        the previous line where the previously used search
  1704.             pattern matches
  1705.     \&        the next line where the previously used substitute
  1706.             pattern matches
  1707.  
  1708. Each may be followed (several times) by '+' or '-' and an optional number.
  1709. This number is added or subtracted from the preceding line number.  If the
  1710. number is omitted, 1 is used.
  1711.  
  1712. The "/" and "?" may be preceded with another address.  The search starts from
  1713. there.  The "/" and "?" after {pattern} are required to separate the pattern
  1714. from anything that follows.
  1715.  
  1716. The {number} must be between 0 and the number of lines in the file.  A 0 is
  1717. interpreted as a 1, except with the commands tag, pop and read.
  1718.  
  1719. Examples:
  1720.     .+3        three lines below the cursor
  1721.     /that/+1    the line below the next line containing "that"
  1722.     .,$        from current line until end of file
  1723.     0;/that        the first line containing "that"
  1724.  
  1725. Some commands allow for a count after the command.  This count is used as the
  1726. number of lines to be used, starting with the line given in the last line
  1727. specifier (the default is the cursor line).  The commands that accept a count
  1728. are the ones that use a range but do not have a file name argument (because
  1729. a file name can also be a number).
  1730.  
  1731. Examples:
  1732.     :s/x/X/g 5    substitute 'x' by 'X' in the current line and four
  1733.             following lines
  1734.     :23d 4        delete lines 23, 24, 25 and 26
  1735.  
  1736. A range should have the lower line number first.  If this is not the case, Vim
  1737. will ask you if it should swap the line numbers.  This is not done within the
  1738. global command ":g".
  1739.  
  1740.                             *N:*
  1741. When giving a count before entering ":", this is translated into:
  1742.         :.,.+(count - 1)
  1743. In words: The 'count' lines at and after the cursor.  Example: To delete
  1744. three lines:
  1745.         3:d<CR>        is translated into: .,.+2d<CR>
  1746.  
  1747.                             *v_:*
  1748. {Visual}:    Starts a command line with the Visual selected lines as a
  1749.         range.  The code ":'<,'>" is used for this range, which makes
  1750.         it possible to select a similar line from the command line
  1751.         history for repeating a command on different Visually selected
  1752.         lines.
  1753.  
  1754.  
  1755. 4.4.5 Ex special characters                *cmdline_special*
  1756.  
  1757. In Ex commands, at places where a file name can be used, the following
  1758. characters have a special meaning.  To avoid the special meaning of '%' and
  1759. '#' insert a backslash before it.
  1760.     %       is replaced with the current filename        *:_%*
  1761.     #       is replaced with the alternate filename        *:_#*
  1762.     #n       (where n is a number) is replaced with the filename of
  1763.            buffer n.  "#0" is the same as "#"
  1764.  
  1765. Note: the next four are typed literally, these are not special keys!
  1766.                    *:<cword>* *:<cWORD>* *:<cfile>* *:<afile>*
  1767.     <cword>    is replaced with the word under the cursor
  1768.     <cWORD>    is replaced with the WORD under the cursor (see |WORD|)
  1769.     <cfile>    is replaced with the path name under the cursor
  1770.     <afile>    when executing autocommands, is replaced with the file name
  1771.            for a file read or write
  1772.  
  1773.                     *:_%:* *::p* *::h* *::t* *::r* *::e*
  1774. After "%", "#", "#n", "<cfile>" or "<afile>" modifiers can be given (in this
  1775. order):
  1776.     :p       Make file name a full path.  Must be the first modifier.
  1777.     :h       Head of the file name (the last component and any
  1778.            separators removed).  Cannot be used with :e, :r or :t.
  1779.            Can be repeated to remove several components at the end.
  1780.            When the file name is an absolute path (starts with "/" for
  1781.            Unix; "x:\" for MS-DOS, WIN32, OS/2; "drive:" for Amiga),
  1782.            that part is not removed.  When there is no head (path is
  1783.            relative to current directory) the result is empty.
  1784.     :t       Tail of the file name (last component of the name).  Must
  1785.            precede any :r or :e.
  1786.     :r       Root of the file name (the last extension removed).  When
  1787.            there is only an extension (file name that starts with
  1788.            '.', e.g., ".vimrc"), it is not removed.  Can be repeated to
  1789.            remove several extensions (last one first).
  1790.     :e       Extension of the file name.  Only makes sense when used
  1791.            alone.  When there is no extension the result is empty.
  1792.            When there is only an extension (file name that starts with
  1793.            '.'), the result is empty.  Can be repeated to include more
  1794.            extensions.  If there are not enough extensions (but at
  1795.            least one) as much as possible are included.
  1796.  
  1797. Examples, when the file name is "src/version.c":
  1798.     :p       /home/mool/vim/src/version.c
  1799.     :h              src
  1800.     :p:h       /home/mool/vim/src
  1801.     :p:h:h       /home/mool/vim
  1802.     :t                  version.c
  1803.     :p:t                  version.c
  1804.     :r              src/version
  1805.     :p:r       /home/mool/vim/src/version
  1806.     :t:r                  version
  1807.     :e                      c
  1808.  
  1809. Examples, when the file name is "src/version.c.gz":
  1810.     :p       /home/mool/vim/src/version.c.gz
  1811.     :e                                gz
  1812.     :e:e                                  c.gz
  1813.     :e:e:e                                c.gz
  1814.     :e:e:r                                c
  1815.     :r                        src/version.c
  1816.     :r:e                                  c
  1817.     :r:r                      src/version
  1818.     :r:r:r                    src/version
  1819.  
  1820.                                 *:_%<*
  1821. If a "<" is appended to "%", "#", "#n" or "CTRL-V p" the extension of the file
  1822. name is removed (everything after and including the last '.' in the file
  1823. name).  This is included for backwards compatibility with version 3.0, the
  1824. ":r" form is preferred.  Examples:
  1825.  
  1826.     %        current file name
  1827.     %<        current file name without extension
  1828.     #        alternate file name for current window
  1829.     #<        idem, without extension
  1830.     #31        alternate file number 31
  1831.     #31<        idem, without extension
  1832.     <cword>        word under the cursor
  1833.     <cWORD>        WORD under the cursor (see |WORD|)
  1834.     <cfile>        path name under the cursor
  1835.     <cfile><    idem, without extension
  1836.  
  1837. Note: Where a file name is expected wildcards expansion is done.  On Unix the
  1838. shell is used for this.  Backticks also work, like in ":n `echo *.c`".
  1839. But expansion is only done if there are any wildcards before expanding the
  1840. '%', '#', etc..  This avoids expanding wildcards inside a file name.
  1841. Examples: (alternate filename is "?readme?")
  1842.     command        expands to
  1843.     :e #        :e ?readme?
  1844.     :e `ls #`    :e {files matching "?readme?"}
  1845.     :e #.*        :e {files matching "?readme?.*"}
  1846.  
  1847.  
  1848. 4.5 The window contents                    *window_contents*
  1849.  
  1850. In command and Insert/Replace mode the screen window will show the current
  1851. contents of the buffer: What You See Is What You Get.  There are two
  1852. exceptions:
  1853. - When the 'cpoptions' option contains '$', and the change is within one line,
  1854.   the text is not directly deleted, but a '$' is put at the last deleted
  1855.   character.
  1856. - When inserting text in one window, other windows on the same text are not
  1857.   updated until the insert is finished.
  1858. {Vi: The screen is not always updated on slow terminals}
  1859.  
  1860. Lines longer than the window width will wrap, unless the 'wrap' option is off
  1861. (see below).  The 'linebreak' option can be set to wrap at a blank character.
  1862.  
  1863. The bottom lines in the window may start with one of these two characters:
  1864.  
  1865. '@'    The next line is too long to fit in the window.
  1866. '~'    Below the last line in the buffer.
  1867.  
  1868. If the bottom line is completely filled with '@', the line that is at the
  1869. top of the window is too long to fit in the window.  If the cursor is on this
  1870. line you can't see what you are doing, because this part of the line is not
  1871. shown.  However, the part of the line before the '@'s can be edited normally.
  1872. {Vi: gives an "internal error" on lines that do not fit in the window}
  1873.  
  1874. The 'showbreak' option contains the string to put in front of wrapped lines.
  1875.  
  1876.                             *wrap_off*
  1877. If the 'wrap' option is off, long lines will not wrap.  Only the part that
  1878. fits on the screen is shown.  If the cursor is moved to a part of the line
  1879. that is not shown, the screen is scrolled horizontally.  The advantage of
  1880. this method is that columns are shown as they are and lines that cannot fit
  1881. on the screen can be edited.  The disadvantage is that you cannot see all the
  1882. characters of a line at once.  The 'sidescroll' option can be set to the
  1883. minimal number of columns to scroll.  {Vi: has no 'wrap' option}
  1884.  
  1885. All normal ASCII characters are displayed directly on the screen.  The <Tab>
  1886. is replaced with the number of spaces that it represents.  Other non-printing
  1887. characters are replaced with "^{char}", where {char} is the non-printing
  1888. character with 64 added.  Thus character 7 (bell) will be shown as "^G".
  1889. Characters between 127 and 160 are replaced with "~{char}", where {char} is
  1890. the character with 64 subtracted.  These characters occupy more than one
  1891. position on the screen.  The cursor can only be positioned on the first one.
  1892.  
  1893. If you set the 'number' option, all lines will be preceded with their
  1894. number.  Tip: If you don't like wrapping lines to mix with the line numbers,
  1895. set the 'showbreak' option to eight spaces:
  1896.     ":set showbreak=\ \ \ \ \ \ \ \ "
  1897.  
  1898. If you set the 'list' option, <Tab> characters will not be shown as several
  1899. spaces, but as "^I".  A '$' will be placed at the end of the line, so you can
  1900. find trailing blanks.
  1901.  
  1902. In Command-line mode only the command line itself is shown correctly.  The
  1903. display of the buffer contents is updated as soon as you go back to Command
  1904. mode.
  1905.  
  1906. Some commands hand over the window to external commands (e.g., ":shell" and
  1907. "=").  After these commands are finished the window may be clobbered with
  1908. output from the external command, so it needs to be redrawn.  This is also
  1909. the case if something is displayed on the status line that is longer than
  1910. the width of the window.  If you are expected to have a look at the screen
  1911. before it is redrawn, you get this message:
  1912.  
  1913.     Press RETURN or enter command to continue
  1914.  
  1915. After you type a key the screen will be redrawn and Vim continues.  If you
  1916. type <CR>, <SP> or <NL> nothing else happens.  If you type any other key, it
  1917. will be interpreted as (the start of) a new command.  {Vi: only ":" commands
  1918. are interpreted}
  1919.  
  1920. The last line of the window is used for status and other messages.  The
  1921. status messages will only be used if an option is on:
  1922.  
  1923. status message            option         default    Unix default
  1924. current mode            'showmode'    on        on
  1925. command characters        'showcmd'    on        off
  1926. cursor position            'ruler'        off        off
  1927.  
  1928. The current mode is "-- INSERT --" or "-- REPLACE --", see |'showmode'|.  The
  1929. command characters are those that you typed but were not used yet.  {Vi: does
  1930. not show the characters you typed or the cursor position}
  1931.  
  1932. If you have a slow terminal you can switch off the status messages to speed
  1933. up editing:
  1934.     :set nosc noru nosm
  1935.  
  1936. If there is an error, an error message will be shown for at least one second
  1937. (in reverse video).  {Vi: error messages may be overwritten with other
  1938. messages before you have a chance to read them}
  1939.  
  1940. Some commands show how many lines were affected.  Above which threshold this
  1941. happens can be controlled with the 'report' option (default 2).
  1942.  
  1943. On the Amiga Vim will run in a CLI window.  The name Vim and the full name of
  1944. the current filename will be shown in the title bar.  When the window is
  1945. resized, Vim will automatically redraw the window.  You may make the window as
  1946. small as you like, but if it gets too small not a single line will fit in it.
  1947. Make it at least 40 characters wide to be able to read most messages on the
  1948. last line.
  1949.  
  1950. On most Unix systems window resize works ok.  {Vi: not ok}
  1951.  
  1952.  
  1953. 4.6 Abbreviations                    *abbreviations*
  1954.  
  1955. Abbreviations are used in insert mode, Replace mode and Command-line mode.
  1956. If you enter a word that is an abbreviation, it is replaced with the word it
  1957. stands for.  This can be used to save typing for often used long words.
  1958.  
  1959. There are three types of abbreviations:
  1960.  
  1961. full-id      The "full-id" type consists entirely of keyword characters (letters
  1962.       and characters from 'iskeyword' option).  This is the most common
  1963.       abbreviation.
  1964.  
  1965.       Examples: "foo", "g3", "-1"
  1966.  
  1967. end-id      The "end-id" type ends in a keyword character, but all the other
  1968.       characters are not keyword characters.
  1969.  
  1970.       Examples: "#i", "..f", "$/7"
  1971.  
  1972. non-id      The "non-id" type ends in a non-keyword character, the other
  1973.       characters may be of any type, excluding space and Tab.  {this type
  1974.       is not supported by Vi}
  1975.  
  1976.       Examples: "def#", "4/7$"
  1977.  
  1978. Examples of strings that cannot be abbreviations: "a.b", "#def", "a b", "_$r"
  1979.  
  1980. An abbreviation is only recognized when you type a non-keyword character.
  1981. This can also be the <Esc> that ends insert mode or the <CR> that ends a
  1982. command.  The characters before the cursor must match the abbreviation.  Each
  1983. type has an additional rule:
  1984.  
  1985. full-id      In front of the match is a non-keyword character, or this is where
  1986.       the line or insertion starts.  Exception: When the abbreviation is
  1987.       only one character, it is not recognized if there is a non-keyword
  1988.       character in front of it, other than a space or a <Tab>.
  1989.  
  1990. end-id      In front of the match is a keyword character, or a space or a <Tab>,
  1991.       or this is where the line or insertion starts.
  1992.  
  1993. non-id      In front of the match is a space, <Tab> or the start of the line or
  1994.       the insertion.
  1995.  
  1996. Examples: (<CURSOR> is where you type a non-keyword character)
  1997.     ":ab foo four old otters" (Note that spaces in the <rhs> are allowed
  1998.                   and included in the replacement string.)
  1999.         " foo<CURSOR>"      is expanded to " four old otters"
  2000.         " foobar<CURSOR>" is not expanded
  2001.         "barfoo<CURSOR>"  is not expanded
  2002.  
  2003.     ":ab #i #include"
  2004.         "#i<CURSOR>"      is expanded to "#include"
  2005.         ">#i<CURSOR>"      is not expanded
  2006.  
  2007.     ":ab ;; <endofline>"
  2008.         "test;;"      is not expanded
  2009.         "test ;;"      is expanded to "test <endofline>"
  2010.  
  2011. To avoid the abbreviation in insert mode: Type part of the abbreviation, exit
  2012. insert mode with <Esc>, re-enter insert mode with "a" and type the rest.  Or
  2013. type CTRL-V before the character after the abbreviation.
  2014. To avoid the abbreviation in Command-line mode: Type CTRL-V twice somewhere in
  2015. the abbreviation to avoid it to be replaced.  A CTRL-V in front of a normal
  2016. character is mostly ignored otherwise.
  2017.  
  2018. There are no default abbreviations.
  2019.  
  2020. Abbreviations are never recursive.  You can use ":ab f f-o-o" without any
  2021. problem.  But abbreviations can be mapped.  {some versions of Vi support
  2022. recursive abbreviations, for no apparent reason}
  2023.  
  2024. Abbreviations are disabled if the 'paste' option is on.
  2025.  
  2026.                         *:ab* *:abbreviate*
  2027. :ab[breviate]        list all abbreviations.  The character in the first
  2028.             column indicates the mode where the abbreviation is
  2029.             used: 'i' for insert mode, 'c' for Command-line
  2030.             mode, '!' for both.
  2031.  
  2032. :ab[breviate] <lhs>    list the abbreviations that start with <lhs>
  2033.  
  2034. :ab[breviate] <lhs> <rhs>
  2035.             add abbreviation for <lhs> to <rhs>.  If <lhs> already
  2036.             existed it is replaced with the new <rhs>.  <rhs> may
  2037.             contain spaces.
  2038.  
  2039.                         *:una* *:unabbreviate*
  2040. :una[bbreviate] <lhs>    remove abbreviation for <lhs> from the list
  2041.  
  2042.                         *:norea* *:noreabbrev*
  2043. :norea[bbrev] [lhs] [rhs]
  2044.             same as ":ab", but no remapping for this <rhs> {not
  2045.             in Vi}
  2046.  
  2047.                         *:ca* *:cabbrev*
  2048. :ca[bbrev] [lhs] [rhs]    same as ":ab", but for Command-line mode only.  {not
  2049.             in Vi}
  2050.  
  2051.                         *:cuna* *:cunabbrev*
  2052. :cuna[bbrev] <lhs>    same as ":una", but for Command-line mode only.  {not
  2053.             in Vi}
  2054.  
  2055.                         *:cnorea* *:cnoreabbrev*
  2056. :cnorea[bbrev] [lhs] [rhs]
  2057.             same as ":ab", but for Command-line mode only and no
  2058.             remapping for this <rhs> {not in Vi}
  2059.  
  2060.                         *:ia* *:iabbrev*
  2061. :ia[bbrev] [lhs] [rhs]    same as ":ab", but for Insert mode only.  {not in Vi}
  2062.  
  2063.                         *:iuna* *:iunabbrev*
  2064. :iuna[bbrev] <lhs>    same as ":una", but for insert mode only.  {not in
  2065.             Vi}
  2066.  
  2067.                         *:inorea* *:inoreabbrev*
  2068. :inorea[bbrev] [lhs] [rhs]
  2069.             same as ":ab", but for Insert mode only and no
  2070.             remapping for this <rhs> {not in Vi}
  2071.  
  2072.                             *:abc* *:abclear*
  2073. :abc[lear]        Remove all abbreviations.  {not in Vi}
  2074.  
  2075.                             *:iabc* *:iabclear*
  2076. :iabc[lear]        Remove all abbreviations for Insert mode.  {not in Vi}
  2077.  
  2078.                             *:cabc* *:cabclear*
  2079. :cabc[lear]        Remove all abbreviations for Command-line mode.  {not
  2080.             in Vi}
  2081.  
  2082.                             *using_CTRL-V*
  2083. It is possible to use special characters in the rhs of an abbreviation.
  2084. CTRL-V has to be used to avoid the special meaning of most non printable
  2085. characters.  How many CTRL-Vs need to be typed depends on how you enter the
  2086. abbreviation.  This also applies to mappings.  Let's use an example here.
  2087.  
  2088. Suppose you want to abbreviate "esc" to enter an <Esc> character.  When you
  2089. type the ":ab" command in Vim, you have to enter this: (here ^V is a CTRL-V
  2090. and ^[ is <Esc>)
  2091.  
  2092. You type:   ab esc ^V^V^V^V^V^[
  2093.  
  2094.     All keyboard input is subjected to ^V quote interpretation, so
  2095.     the first, third, and fifth ^V  characters simply allow the second,
  2096.     and fourth ^Vs, and the ^[, to be entered into the command line.
  2097.  
  2098. You see:    ab esc ^V^V^[
  2099.  
  2100.     The command line contains two actual ^Vs before the ^[.  This is
  2101.     how it should appear in your .exrc file, if you choose to go that
  2102.     route.  The first ^V is there to quote the second ^V; the :ab
  2103.     command uses ^V as its own quote character, so you can include quoted
  2104.     whitespace or the | character in the abbreviation.   The :ab command
  2105.     doesn't do anything special with the ^[ character, so it doesn't need
  2106.     to be quoted.  (Although quoting isn't harmful; that's why typing 7
  2107.     [but not 8!] ^Vs works.)
  2108.  
  2109. Stored as:  esc     ^V^[
  2110.  
  2111.     After parsing, the abbreviation's short form ("esc") and long form
  2112.     (the two characters "^V^[") are stored in the abbreviation table.
  2113.     If you give the :ab command with no arguments, this is how the
  2114.     abbreviation will be displayed.
  2115.  
  2116.     Later, when the abbreviation is expanded because the user typed in
  2117.     the word "esc", the long form is subjected to the same type of
  2118.     ^V interpretation as keyboard input.  So the ^V protects the ^[
  2119.     character from being interpreted as the "exit input-mode" character.
  2120.     Instead, the ^[ is inserted into the text.
  2121.  
  2122. Expands to: ^[
  2123.  
  2124. [example given by Steve Kirkendall]
  2125.  
  2126.  
  2127. 4.7 Digraphs                        *digraphs*
  2128.  
  2129.                         *:dig* *:digraphs*
  2130. :dig[raphs]        show currently defined digraphs.  {not in Vi}
  2131.  
  2132. :dig[raphs] {char1}{char2} {number} ...
  2133.             Add digraph {char1}{char2} to the list.  {number} is
  2134.             the decimal representation of the character.
  2135.  
  2136. Digraphs are used to enter characters that normally cannot be entered by
  2137. an ordinary keyboard.  These are mostly accented characters which have the
  2138. eighth bit set.  The digraphs are easier to remember than the decimal number
  2139. that can be entered with CTRL-V (see above).
  2140.  
  2141. Vim must have been compiled with DIGRAPHS defined.  If this wasn't done, the
  2142. ":digraph" command will display an error message.  You can also check this
  2143. with the ":version" command.  If it shows "+digraphs" then it's included,
  2144. "-digraphs" means it's not included.
  2145.  
  2146. There are two methods to enter digraphs:            *i_digraph*
  2147.     CTRL-K {char1} {char2}        or
  2148.     {char1} <BS> {char2}
  2149. The first is always available.  The second only when the 'digraph' option is
  2150. set.
  2151.  
  2152. If a digraph with {char1}{char2} does not exist, a digraph {char2}{char1} is
  2153. searched for.  This will help when you don't remember which character comes
  2154. first.
  2155.  
  2156. Note that when you enter CTRL-K {char1}, where {char1} is a special key, the
  2157. code for that special key is entered.  This is not a digraph.
  2158.  
  2159. Once you have entered the digraph the character is treated like a normal
  2160. character, taking up only one character in the file and on the screen.
  2161. Example:
  2162.     '|' <BS> '|'    will enter the double '|' character (166)
  2163.     'a' <BS> '^'    will enter an 'a' with a hat (226)
  2164.     CTRL-K '-' '-'    will enter a minus sign (173)
  2165.  
  2166. The default digraphs are listed in the file "vim_digr.txt" |digraph_table|.
  2167. There are two sets: One that is used for MS-DOS and one for the international
  2168. standard character set that is mostly used on Unix systems and the Amiga.
  2169. With the wrong character set they will look illogical.
  2170.  
  2171. For CTRL-K there is one general digraph: CTRL-K <Space> {char} will enter
  2172. {char} with the highest bit set.  This can be used to enter meta-characters.
  2173.  
  2174. The <Esc> character cannot be part of a digraph.  When hitting <Esc> the
  2175. entering of the digraph is aborted and Insert mode or command-line mode is
  2176. ended, just like hitting an <Esc>.
  2177.  
  2178. If you accidently typed an 'a' that should be an 'e', you will type 'a' <BS>
  2179. 'e'.  But that is a digraph, so you will not get what you want.  To correct
  2180. this, you will have to type <BS> e again.  To avoid this don't set the
  2181. 'digraph' option and use CTRL-K to enter digraphs.
  2182.  
  2183. You may have problems using Vim with characters which have an ascii value >
  2184. 128.  For example: You insert ue (u-umlaut) and the editor echoes \334 in
  2185. Insert mode.  After leaving the Insert mode everything is fine.  Also fmt
  2186. removes all characters with ascii > 128 from the text being formated.
  2187. On some Unix systems this means you have to define the environment-variable
  2188. LC_CTYPE.  If you are using csh then put in your .cshrc following line:
  2189.     setenv LC_CTYPE=iso_8859_1
  2190.  
  2191.  
  2192. 4.8 Using the mouse                    *mouse_using*
  2193.  
  2194. This section is about using the mouse on a terminal or a terminal window.  How
  2195. to use the mouse in a GUI window is explained in |gui_mouse|.  Don't forget to
  2196. do ":set mouse=a", otherwise Vim won't recognize the mouse in all modes (See
  2197. 'mouse').
  2198.  
  2199. Currently the mouse is supported for Unix in an xterm window and for MS-DOS.
  2200. Mouse clicks can be used to position the cursor, select the Visual area and
  2201. paste.  There are no menus, use the GUI version for that.
  2202.  
  2203. The characters in the 'mouse' option tell in which situations the mouse will
  2204. be used by Vim:
  2205.         n    Normal mode
  2206.         v    Visual mode
  2207.         i    Insert mode
  2208.         c    Command-line mode
  2209.         h    all previous modes when in a help file
  2210.         a    all previous modes
  2211.         r    for "Hit return ..." question
  2212.  
  2213. The default for 'mouse' is empty, the mouse is not used.  Normally you would do
  2214.     :set mouse=a
  2215. to start using the mouse (this is equivalent to setting 'mouse' to "nvich").
  2216. If you only want to use the mouse in a few modes or also want to use it for
  2217. the two questions you will have to concatenate the letters for those modes.
  2218. For example:
  2219.     :set mouse=nv
  2220. Will make the mouse work in Normal mode and Visual mode.
  2221.     :set mouse=h
  2222. Will make the mouse work in help files only (so you can use "g<LeftMouse>" to
  2223. jump to tags).
  2224.  
  2225. In an xterm, with the currently active mode included in the 'mouse' option,
  2226. normal mouse clicks are used by Vim, mouse clicks with the shift or ctrl key
  2227. pressed go the the xterm.  With the currently active mode not included in
  2228. 'mouse' all mouse clicks go to the xterm.
  2229.  
  2230. Here is how you copy and paste a piece of text:
  2231.  
  2232. Copy/paste with the mouse and Visual mode ('mouse' option must be set, see
  2233. above):
  2234. 1. Press left mouse button on first letter of text, move mouse pointer to last
  2235.    letter of the text and release the button.  This will start Visual mode and
  2236.    highlight the selected area.
  2237. 2. Press "y" to yank the Visual text in the unnamed register.
  2238. 3. Click the left mouse button at the insert position.
  2239. 4. Click the middle mouse button.
  2240.  
  2241. Shortcut: If the insert position is on the screen at the same time as the
  2242. Visual text, you can do 2, 3 and 4 all in one: Click the middle mouse button
  2243. at the insert position.
  2244.  
  2245.                             *xterm_copy_paste*
  2246. Copy/paste in xterm with (current mode NOT included in 'mouse'):
  2247. 1. Press left mouse button on first letter of text, move mouse pointer to last
  2248.    letter of the text and release the button.
  2249. 2. Use normal Vim commands to put the cursor at the insert position.
  2250. 3. Press "a" to start Insert mode.
  2251. 4. Click the middle mouse button.
  2252. 5. Press ESC to end Insert mode.
  2253. (The same can be done with anything in 'mouse' if you keep the shift key
  2254. pressed while using the mouse)
  2255.  
  2256. Note: if you loose the 8th bit when pasting (special characters are translated
  2257. into other characters), you may have to do "stty cs8 -istrip" in your shell
  2258. before starting Vim.
  2259.  
  2260. Thus in an xterm the shift and ctrl keys cannot be used with the mouse.  To
  2261. make it possible to do the mouse commands that require the ctrl modifier, the
  2262. "g" key can be typed before using the mouse:
  2263.     "g<LeftMouse>"    is "<C-LeftMouse>    (jump to tag under mouse click)
  2264.     "g<RightMouse>" is "<C-RightMouse>    ("CTRL-T")
  2265.  
  2266. A short overview of what the mouse buttons do:
  2267.  
  2268. Normal Mode:
  2269. event          position       Visual      change  action
  2270.            cursor              window
  2271. <LeftMouse>     yes         end        yes
  2272. <C-LeftMouse>   yes         end        yes       "CTRL-]" (2)
  2273. <S-LeftMouse>   yes      no change        yes       "*" (2)    *<S-LeftMouse>*
  2274. <LeftDrag>      yes    start or extend (1) no              *<LeftDrag>*
  2275. <LeftRelease>   yes    start or extend (1) no
  2276. <MiddleMouse>   yes      if not active     no       put
  2277. <MiddleMouse>   yes      if active        no       yank and put
  2278. <RightMouse>    yes    start or extend     yes
  2279. <S-RightMouse>  yes       no change        yes       "#" (2)    *<S-RightMouse>*
  2280. <C-RightMouse>  no            no change        no       "CTRL-T"
  2281. <RightDrag>     yes        extend        no              *<RightDrag>*
  2282. <RightRelease>  yes        extend        no              *<RightRelease>*
  2283.  
  2284. Insert or Replace Mode:
  2285. event          position       Visual      change  action
  2286.            cursor              window
  2287. <LeftMouse>     yes     (cannot be active)  yes
  2288. <C-LeftMouse>   yes     (cannot be active)  yes       "CTRL-O^]" (2)
  2289. <S-LeftMouse>   yes     (cannot be active)  yes       "CTRL-O*" (2)
  2290. <LeftDrag>      yes     start or extend (1) no       like CTRL-O (1)
  2291. <LeftRelease>   yes     start or extend (1) no       like CTRL-O (1)
  2292. <MiddleMouse>   no      (cannot be active)  no       put register
  2293. <RightMouse>    yes     start or extend        yes       like CTRL-O
  2294. <S-RightMouse>  yes     (cannot be active)  yes       "CTRL-O#" (2)
  2295. <C-RightMouse>  no         (cannot be active)  no       "CTRL-O CTRL-T"
  2296.  
  2297. (1) only if mouse pointer moved since press
  2298. (2) only if click is in same buffer
  2299.  
  2300. Clicking the left mouse button causes the cursor to be positioned.  If the
  2301. click is in another window that window is made the active window.  When
  2302. editing the command line the cursor can only be positioned on the
  2303. command line.  When in Insert mode Vim remains in Insert mode.  If 'scrolloff'
  2304. is set, and the cursor is positioned within 'scrolloff' lines from the window
  2305. border, the text is scrolled.
  2306.  
  2307. A Visual area can be selected by pressing the left mouse button on the first
  2308. character, moving the mouse to the last character, then releasing the mouse
  2309. button.  You will not always see the Visual selection until you release the
  2310. button, only in some versions (GUI, MS-DOS, WIN32) will the dragging be shown
  2311. immediately.  Note that you can make the text scroll by moving the mouse at
  2312. least one character in the first/last line in the window when 'scrolloff' is
  2313. non-zero.
  2314.  
  2315. In Normal and Visual mode clicking the right mouse button causes the Visual
  2316. area to be extended.  When clicking in a window which is editing another
  2317. buffer, the Visual mode is stopped.
  2318.  
  2319. Double, triple and quadruple clicks are supported when the GUI is active,
  2320. for MS-DOS and Win32, and for an xterm (if the gettimeofday() function is
  2321. available).  Double clicking may be done to make the selection word-wise,
  2322. triple clicking makes it line-wise, and quadruple clicking makes it
  2323. rectangular block-wise.  For MS-DOS and xterm the time for double clicking can
  2324. be set with the 'mousetime' option.  For the other systems this time is
  2325. defined outside of Vim.
  2326.  
  2327. In Insert mode, when a Visual area is selected, Vim goes into Normal mode
  2328. temporarily.  When Visual mode ends, it returns to Insert mode.  This is like
  2329. using CTRL-O in Insert mode.
  2330.  
  2331.                             *drag_status_line*
  2332. When working with several windows, the size of the windows can be changed by
  2333. dragging the status line with the mouse.  Point the mouse at a status line,
  2334. press the left button, move the mouse to the new position of the status line,
  2335. release the button.  Just clicking the mouse in a status line makes that window
  2336. the current window, without moving the cursor.  If by selecting a window it
  2337. will change position or size, the dragging of the status line will look
  2338. confusing, but it will work (just try it).
  2339.  
  2340. Mouse clicks can be mapped.  The codes for mouse clicks are:
  2341.      code        mouse button          normal action
  2342.  <LeftMouse>     left pressed            set cursor position
  2343.  <LeftDrag>     left moved while pressed   extend Visual area
  2344.  <LeftRelease>     left released            set Visual area end
  2345.  <MiddleMouse>     middle pressed            paste text at cursor position
  2346.  <MiddleDrag>     middle moved while pressed -
  2347.  <MiddleRelease> middle released        -
  2348.  <RightMouse>     right pressed            extend Visual area
  2349.  <RightDrag>     right moved while pressed  extend Visual area
  2350.  <RightRelease>  right released            set Visual area end
  2351.  
  2352. Examples:
  2353.     :noremap <MiddleMouse> <LeftMouse><MiddleMouse>
  2354. Paste at the position of the middle mouse button click (otherwise the paste
  2355. would be done at the cursor position).
  2356.  
  2357.     :noremap <LeftRelease> <LeftRelease>y
  2358. Immediately yank the Visually highlighted text.
  2359.  
  2360. Note the use of ":noremap" instead of "map" to avoid a recursive mapping.
  2361.  
  2362.                         *mouse_swap_buttons*
  2363. To swap the meaning of the left and right mouse buttons:
  2364.     :noremap    <LeftMouse>    <RightMouse>
  2365.     :noremap    <LeftDrag>    <RightDrag>
  2366.     :noremap    <LeftRelease>    <RightRelease>
  2367.     :noremap    <RightMouse>    <LeftMouse>
  2368.     :noremap    <RightDrag>    <LeftDrag>
  2369.     :noremap    <RightRelease>    <LeftRelease>
  2370.     :noremap    g<LeftMouse>    <C-RightMouse>
  2371.     :noremap    g<RightMouse>    <C-LeftMouse>
  2372.     :noremap!    <LeftMouse>    <RightMouse>
  2373.     :noremap!    <LeftDrag>    <RightDrag>
  2374.     :noremap!    <LeftRelease>    <RightRelease>
  2375.     :noremap!    <RightMouse>    <LeftMouse>
  2376.     :noremap!    <RightDrag>    <LeftDrag>
  2377.     :noremap!    <RightRelease>    <LeftRelease>
  2378.  
  2379.  
  2380. 4.9 Online help                    *online_help*
  2381.  
  2382.             *help* *<Help>* *:h* *:help* *<F1>* *i_<F1>* *i_<Help>*
  2383. <Help>        or
  2384. :h[elp]            Split the window and display the help file in
  2385.             read-only mode.  If there is a help window open
  2386.             already, use that one.  {not in Vi}
  2387.  
  2388. :h[elp] {subject}    Like ":help", additionally jump to the tag
  2389.             {subject}.  {subject} can be a regular expression.
  2390.                :help z.    jump to help for any "z" command
  2391.                :help z\.    jump to the help for "z."
  2392.             If there is no full match for the pattern, or there
  2393.             are several matches, the "best" match will be used.
  2394.             A match is considered to be better when:
  2395.             - if no match with same case is found, a match with
  2396.               ignoring case will be used
  2397.             - the match is after a non-alphanumereic character
  2398.             - it is at near the beginning of the tag
  2399.             - more alphanumeric characters match
  2400.             - the length of the matched is smaller
  2401.             Note that the longer the {subject} you give, the less
  2402.             matches will be found.  You can get an idea how this
  2403.             all works by using commandline completion (type CTRL-D
  2404.             after ":help subject".  {not in Vi}
  2405.  
  2406. The help file name can be set with the 'helpfile' option.  The initial height
  2407. of the help window can be set with the 'helpheight' option (default 20).
  2408. Jump to specific subjects by using tags.  This can be done in two ways:
  2409. - Use the "CTRL-]" command while standing on the name of a command or option.
  2410.   This only works when the tag is a keyword.  "<C-Leftmouse>" and
  2411.   "g<LeftMouse>" work just like "CTRL-]".
  2412. - use the ":ta {subject}" command.  This works with all characters.
  2413.  
  2414. Use "CTRL-T" to jump back.
  2415. Use ":q" to close the help window.
  2416.  
  2417.                             *help_xterm_window*
  2418. If you want to have the help in another xterm window, you could use this
  2419. command:
  2420.     :!xterm -e vim +help &
  2421.  
  2422.                             *doc_files*
  2423. All the help files must be in the same directory.  The files are:
  2424.     vim_help.txt    overview and quick reference          |vim_help.txt|
  2425.     vim_idx.txt    alphabetical index of all commands    |vim_idx.txt|
  2426.     vim_ref.txt    reference manual (this file)          |vim_ref.txt|
  2427.     vim_win.txt    reference manual for windows commands |vim_win.txt|
  2428.     vim_diff.txt    main differences between Vim and Vi   |vim_diff.txt|
  2429.     vim_digr.txt    list of available digraphs          |vim_digr.txt|
  2430.     vim_tips.txt    tips on using Vim              |vim_tips.txt|
  2431.     vim_gui.txt    about the Graphical User Interface    |vim_gui.txt|
  2432.     vim_40.txt    about version 4.0              |vim_40.txt|
  2433.     vim_rlh.txt    about the 'rightleft' option          |vim_rlh.txt|
  2434.  
  2435.     vim_unix.txt    Unix specific remarks              |vim_unix.txt|
  2436.     vim_ami.txt    Amiga specific remarks              |vim_ami.txt|
  2437.     vim_dos.txt    MS-DOS specific remarks              |vim_dos.txt|
  2438.     vim_w32.txt    Windows-NT/95 specific remarks          |vim_w32.txt|
  2439.     vim_os2.txt    OS/2 specific remarks              |vim_os2.txt|
  2440.     vim_arch.txt    Archimedes specific remarks          |vim_arch.txt|
  2441.     vim_mac.txt    Macintosh specific remarks          |vim_mac.txt|
  2442.     vim_mint.txt    Atari MiNT specific remarks           |vim_mint.txt|
  2443.  
  2444.     vim_tags    tags file for documentation
  2445.  
  2446.  
  2447. 5. Editing files                    *edit_files*
  2448. ================
  2449.  
  2450. 5.1 Introduction                    *edit_intro*
  2451.  
  2452. Editing a file with Vim means:
  2453.  
  2454. 1. reading the file into the internal buffer
  2455. 2. changing the buffer with editor commands
  2456. 3. writing the buffer into a file
  2457.  
  2458. As long as you don't write the buffer, the original file remains unchanged.
  2459. If you start editing a file (read a file into the buffer), the file name is
  2460. remembered as the "current filename".
  2461.  
  2462. If there already was a current filename, then that one becomes the alternate
  2463. file name.  All filenames are remembered in the file list.  When you enter a
  2464. filename, for editing (e.g., with ":e filename") or writing (e.g., with (:w
  2465. filename"), the filename is added to the list.  You can use this list to
  2466. remember which files you edited and to quickly switch from one file to
  2467. another with the CTRL-^ command (e.g., to copy text).  First type the number
  2468. of the file and then hit CTRL-^.  {Vi: only one alternate filename}
  2469.  
  2470. CTRL-G        or                *CTRL-G* *:f* *:file*
  2471. :f[ile]            Prints the current filename (as typed), the
  2472.             cursor position (unless the 'ruler' option is set),
  2473.             and the file status (readonly, modified).  See the
  2474.             'shortmess' option about how tho make this message
  2475.             shorter.  {Vi does not include column number}
  2476.  
  2477. {count}CTRL-G        Like CTRL-G, but prints the current filename with full
  2478.             path.  If the count is higher than 1 the current
  2479.             buffer number is also given.  {not in Vi}
  2480.  
  2481.                             *g_CTRL-G*
  2482. g CTRL-G        Prints the current position of the cursor in three
  2483.             ways: Column, Line and Character.  If there are
  2484.             characters in the line that take more than one
  2485.             position on the screen (<Tab> or special character),
  2486.             both the "real" column and the screen column are
  2487.             shown, separated with a dash.  See also 'ruler'
  2488.             option.  {not in Vi}
  2489.  
  2490.                             *:file_f*
  2491. :f[ile] {name}        Sets the current filename to {name}.
  2492.  
  2493. :buffers
  2494. :files
  2495. :ls            List all the currently known file names.  See
  2496.             'vim_win.txt' |:files| |:buffers| |:ls|.  {not in
  2497.             Vi}
  2498.  
  2499. Vim will remember the full path name of a file name that you enter.  In most
  2500. cases when the file name is displayed only the name you typed is shown, but
  2501. the full path name is being used if you used the ":cd" command |:cd|.
  2502.  
  2503.                             *home_replace*
  2504. If the environment variable 'HOME' is set, and the file name starts with that
  2505. string, it is often displayed with HOME replaced with "~".  This was done to
  2506. keep file names short.  When reading or writing files the full name is still
  2507. used, the "~" is only used when displaying file names.  When replacing the
  2508. file name would result in just "~", "~/" is used instead (to avoid confusion
  2509. with 'backupext' set to "~").
  2510.  
  2511. When writing the buffer, the default is to use the current filename.  Thus
  2512. when you give the "ZZ" or ":wq" command, the original file will be
  2513. overwritten.  If you do not want this, the buffer can be written into another
  2514. file by giving a filename argument to the ":write" command.  For example:
  2515.  
  2516.     vim testfile
  2517.     [change the buffer with editor commands]
  2518.     :w newfile
  2519.     :q
  2520.  
  2521. This will create a file "newfile", that is a modified copy of "testfile".
  2522. The file "testfile" will remain unchanged.  Anyway, if the 'backup' option is
  2523. set, Vim renames or copies the original file before it will be overwritten.
  2524. You can use this file if you discover that you need the original file.  See
  2525. also the 'patchmode' option.  The name of the backup file is normally the same
  2526. as the original file with 'backupext' appended.  The default "~" is a bit
  2527. strange to avoid accidently overwriting existing files.  If you prefer ".bak"
  2528. change the 'backupext' option.  Extra dots are replaced with '_' on MS-DOS
  2529. machines, when Vim has detected that an MS-DOS-like filesystem is being used
  2530. (e.g., messydos or crossdos) or when the 'shortname' option is on.  The
  2531. backup file can be placed in another directory by setting 'backupdir'.
  2532.  
  2533.                             *auto_shortname*
  2534. Technical: On the Amiga you can use 30 characters for a file name.  But on an
  2535.        MS-DOS-compatible filesystem only 8 plus 3 characters are
  2536.        available.  Vim tries to detect the type of filesystem when it is
  2537.        creating the .swp file.  If an MS-DOS-like filesystem is suspected,
  2538.        a flag is set that has the same effect as setting the 'shortname'
  2539.        option.  This flag will be reset as soon as you start editing a
  2540.        new file.  The flag will be used when making the filename for the
  2541.        ".swp" and ".~" files for the current file.  But when you are
  2542.        editing a file in a normal filesystem and write to an MS-DOS-like
  2543.        filesystem the flag will not have been set.  In that case the
  2544.        creation of the ".~" file may fail and you will get an error
  2545.        message.  Use the 'shortname' option in this case.
  2546.  
  2547. When you started editing without giving a file name, "No File" is displayed in
  2548. messages.  If the ":write" command is used with a file name argument, the file
  2549. name for the current file is set to that file name.  This only happens when
  2550. the 'F' flag is included in 'cpoptions' (by default it is included).  This is
  2551. useful when entering text in an empty buffer and then writing it to a file.
  2552. If 'cpoptions' contains the 'f' flag (by default it is NOT included) the file
  2553. name is set for the ":read file" command.  This is useful when starting Vim
  2554. without an argument and then doing ":read file" to start editing a file.
  2555. Because the file name was set without really starting to edit that file, you
  2556. are protected from overwriting that file.  This is done by setting the
  2557. "notedited" flag.  You can see if this flag is set with the CTRL-G or ":file"
  2558. command.  It will include "[Not edited]" when the "notedited" flag is set.
  2559. When writing the buffer to the current file name (with ":w!"), the "notedited"
  2560. flag is reset.
  2561.  
  2562. Vim remembers whether you have changed the buffer.  You are protected from
  2563. losing the changes you made.  If you try to quit without writing, or want to
  2564. start editing another file, this will be refused.  In order to overrule this
  2565. protection add a '!' to the command.  The changes will then be lost.  For
  2566. example: ":q" will not work if the buffer was changed, but ":q!" will.  To see
  2567. whether the buffer was changed use the "CTRL-G" command.  The message includes
  2568. the string "[Modified]" if the buffer has been changed.
  2569.  
  2570.  
  2571. 5.2 Editing a file                    *edit_a_file*
  2572.  
  2573.                             *:e* *:edit*
  2574. :e[dit] [+cmd]        Edit the current file, unless changes have been made.
  2575.  
  2576.                             *:edit!*
  2577. :e[dit]! [+cmd]        Edit the current file always.  Discard any changes to
  2578.             the buffer.
  2579.  
  2580.                             *:edit_f*
  2581. :e[dit] [+cmd] {file}    Edit {file}, unless changes have been made.
  2582.  
  2583.                             *:edit!_f*
  2584. :e[dit]! [+cmd] {file}    Edit {file} always.  Discard any changes to the
  2585.             buffer.
  2586.  
  2587. :e[dit] #[count]    Edit the [count]th alternate filename (as shown by
  2588.             :files).  This command does the same as [count] CTRL-^.
  2589.  
  2590.                             *:ex*
  2591. :ex [+cmd] [file]    Same as :edit.  {Vi: go from visual to Ex mode}
  2592.  
  2593.                             *:vi* *:visual*
  2594. :vi[sual] [+cmd] [file]    Same as :edit.  {Vi: go from Ex to visual mode}
  2595.  
  2596.                             *:vie* *:view*
  2597. :vie[w] [+cmd] file    Same as :edit, but set 'readonly' option for this
  2598.             buffer.  {not in Vi}
  2599.  
  2600.                             *CTRL-^*
  2601. [count]CTRL-^        Edit [count]th alternate file (equivalent to ":e
  2602.             #[count]").  Without count this gets you to the
  2603.             previously edited file.  This is a quick way to
  2604.             toggle between two (or more) files.  If the
  2605.             'autowrite' option is on and the buffer was
  2606.             changed, write it.
  2607.  
  2608. ]f                            *]f*
  2609. [f                            *[f* *gf*
  2610. gf            Edit the file whose name is under or after the
  2611.             cursor.  Mnemonic: "goto file".   Uses the 'isfname'
  2612.             option to find out which characters are supposed to be
  2613.             in a file name.  Uses the 'path' variable as a list of
  2614.             directory names to look for the file.  Also looks for
  2615.             the file relative to the current file.  This command
  2616.             fails if the current file cannot be abandoned.  If the
  2617.             name is a hypertext link, that looks like
  2618.             "type://machine/path", only "/path" is used.  For Unix
  2619.             the '~' character is expanded, like in "~user/file".
  2620.             {not in Vi}
  2621.  
  2622.                             *:cd*
  2623. :cd            On non-Unix systems: Print the current directory
  2624.             name.  On Unix systems: Change the current directory
  2625.             to the home directory.
  2626.  
  2627. :cd {path}        Change the current directory to {path}.  Does not
  2628.             change the meaning of an already entered file name,
  2629.             because its full path name is remembered.  On MS-DOS
  2630.             this also changes the active drive.
  2631.  
  2632.                             *:chd* *:chdir*
  2633. :chd[ir] [path]        Same as :cd.
  2634.  
  2635.                             *:pw* *:pwd*
  2636. :pw[d]            Print the current directory name.  {Vi: no pwd}
  2637.  
  2638. These commands are used to start editing a single file.  This means that the
  2639. file is read into the buffer and the current filename is set.  You may use the
  2640. ":cd" command to get to another directory, so you will not have to type that
  2641. directory name in front of the filenames.  One warning: After using ":cd" the
  2642. full path name will be used for reading and writing files.  On some networked
  2643. file systems this may cause problems.  The result of using the full path name
  2644. is that the file names currently in use will remain referring to the same
  2645. file.  Example: If you have a file a:test and a directory a:vim the commands
  2646. ":e test" ":cd vim" ":w" will overwrite the file a:test and not write
  2647. a:vim/test.  But if you do ":w test" the file a:vim/test will be written,
  2648. because you gave a new file name and did not refer to a file name before the
  2649. ":cd".
  2650.  
  2651.                             *:filename*
  2652. Note for systems other than Unix and MS-DOS: When using a command that
  2653. accepts a single file name (like ":edit file") spaces in the file name are
  2654. allowed, but trailing spaces are ignored.  This is useful on systems that
  2655. allow file names with embedded spaces (like the Amiga).  Example: The command
  2656. ":e   Long File Name " will edit the file "Long File Name".  When using a
  2657. command that accepts more than one file name (like ":next file1 file2")
  2658. embedded spaces must be escaped with a backslash.
  2659.  
  2660. On Unix you can also use backticks in the file name, for example:
  2661.     :e `find . -name ver\\*.c -print`
  2662. The backslashes before the star are required to prevent "ver*.c" to be
  2663. expanded by the shell before executing the find program.
  2664.  
  2665. You can use the ":e!" command if you messed up the buffer and want to start
  2666. all over again.  The ":e" command is only useful if you have changed the
  2667. current filename.
  2668.  
  2669. Note that ":e file" will fail if there are changes in the current buffer,
  2670. also when the 'autowrite' option is on.  This is illogical, because with
  2671. other commands (e.g., ":next") the current buffer would be written and
  2672. abandoned, but this behaviour is compatible with Vi.  If you encounter this
  2673. problem, you can use CTRL-^ to jump to the file, because the alternate file
  2674. name is set to the argument of the ":e" command.
  2675.  
  2676.                             *:+cmd*
  2677. The [+cmd] can be used to position the cursor in the newly opened file:
  2678.     +        Start at the last line.
  2679.     +{num}        Start at line {num}.
  2680.     +/{pat}        Start at first line containing {pat}.  {pat} must not
  2681.             contain any spaces.
  2682.     +{command}    Execute {command} after opening the new file.
  2683.             {command} is an Ex command.  It must not contain
  2684.             spaces.
  2685.  
  2686.                             *textmode_io*
  2687. When reading a file when the 'textmode' option is off (default for
  2688. non-MS-DOS) the <NL> character is interpreted as end-of-line.  If 'textmode'
  2689. is on (default for MS-DOS), <CR><NL> is also interpreted as end-of-line.
  2690. Also see |textmode_read|.
  2691.  
  2692. When writing a file when the 'textmode' option is off a <NL> character is
  2693. used to separate lines.  When the 'textmode' option is on <CR><NL> is used.
  2694. Also see |textmode_write|.
  2695.  
  2696. You can read a file with 'textmode' set and write it with 'textmode' reset.
  2697. This will replace all <CR><NL> pairs by <NL>.  If you read a file with
  2698. 'textmode' reset and write with 'textmode' set, all <NL> characters will be
  2699. replaced with <CR><NL>.
  2700.  
  2701. If you start editing a new file and the 'textauto' option is on (which is the
  2702. default), Vim will try to detect whether the lines in the file are separated
  2703. by a single <NL> (as used on Unix and Amiga) or by a <CR><NL> pair (MS-DOS).
  2704. Only when ALL lines end in <CR><NL> the 'textmode' option is set, otherwise it
  2705. is reset.  If the 'textmode' option is set on non-MS-DOS systems the message
  2706. "[textmode]" is shown to remind you that something unusual is happening.  On
  2707. MS-DOS systems you get the message "[notextmode]" if the 'textmode' option is
  2708. not set.
  2709.  
  2710. If the 'textauto' option is off and 'textmode' is on, but while reading a file
  2711. some lines did not end in <CR><NL>, "[CR missing]" will be included in the
  2712. file message.
  2713.  
  2714. Before editing binary, executable or Vim script files you should set the
  2715. 'textmode' and 'textauto' options off.  With 'textmode' on you risk that
  2716. single <NL> characters are unexpectedly replaced with <CR><NL>.  A simple way
  2717. to do this is by starting Vim with the "-b" option.
  2718.  
  2719.  
  2720. 5.3 The argument list                    *argument_list*
  2721.  
  2722. If you give more than one filename when starting Vim, this list is
  2723. remembered as the argument list.  Do not confuse this with the file list,
  2724. which you can see with the ":files" command |:files|.  The argument list was
  2725. already present in Vi, the file list is new in Vim.  The file names in the
  2726. argument list will also be present in the file list (unless they were
  2727. deleted with ":bdel").
  2728.  
  2729. You can use the argument list with the following commands:
  2730.  
  2731.                             *:ar* *:args*
  2732. :ar[gs]            Print the argument list, with the current file in
  2733.             square brackets.
  2734.  
  2735.                             *:argu* *:argument*
  2736. :[count]argu[ment] [count] [+cmd]
  2737.             Edit file [count] in the argument list, unless
  2738.             changes have been made and the 'autowrite' option is
  2739.             off.  {Vi: no such command}
  2740.  
  2741. :[count]argu[ment]! [count] [+cmd]
  2742.             Edit file [count] in the argument list, discard any
  2743.             changes to the current buffer.  {Vi: no such command}
  2744.  
  2745.                             *:n* *:next*
  2746. :[count]n[ext] [+cmd]    Edit [count] next file, unless changes have been
  2747.             made and the 'autowrite' option is off {Vi: no
  2748.             count}.
  2749.  
  2750. :[count]n[ext]! [+cmd]    Edit [count] next file, discard any changes to the
  2751.             buffer {Vi: no count}.
  2752.  
  2753. :ar[gs] [+cmd] {arglist}
  2754. :n[ext] [+cmd] {arglist}
  2755.             Define {arglist} as the new argument list and edit
  2756.             the first one, unless changes have been made and the
  2757.             'autowrite' option is off.
  2758.  
  2759. :ar[gs]! [+cmd] {arglist}
  2760. :n[ext]! [+cmd] {arglist}                *:next_f*
  2761.             Define {arglist} as the new argument list and edit
  2762.             the first one.  Discard any changes to the buffer.
  2763.  
  2764. :[count]N[ext] [count] [+cmd]                *:Next* *:N*
  2765.             Edit [count] previous file in argument list, unless
  2766.             changes have been made and the 'autowrite' option is
  2767.             off {Vi: no count}.
  2768.  
  2769. :[count]N[ext]! [count] [+cmd]
  2770.             Edit [count] previous file in argument list.  Discard
  2771.             any changes to the buffer {Vi: no count}.
  2772.  
  2773. :[count]prev[ious] [count] [+cmd]            *:prev* *:previous*
  2774.             Same as :Next {Vi: only in some versions}
  2775.  
  2776.                             *:rew* *:rewind*
  2777. :rew[ind] [+cmd]    Start editing the first file in the argument list,
  2778.             unless changes have been made and the 'autowrite'
  2779.             option is off.
  2780.  
  2781. :rew[ind]! [+cmd]    Start editing the first file in the argument list.
  2782.             Discard any changes to the buffer.
  2783.  
  2784.                             *:la* *:last*
  2785. :la[st] [+cmd]        Start editing the last file in the argument list,
  2786.             unless changes have been made and the 'autowrite'
  2787.             option is off.  {not in Vi}
  2788.  
  2789. :la[st]! [+cmd]        Start editing the last file in the argument list.
  2790.             Discard any changes to the buffer.  {not in Vi}
  2791.  
  2792.                             *:wn* *:wnext*
  2793. :[count]wn[ext] [+cmd]    Write current file and start editing the [count]
  2794.             next file.  {not in Vi}
  2795.  
  2796. :[count]wn[ext] [+cmd] {file}
  2797.             Write current file to {file} and start editing the
  2798.             [count] next file, unless {file} already exists and
  2799.             the 'writeany' option is off.  {not in Vi}
  2800.  
  2801. :[count]wn[ext]! [+cmd] {file}
  2802.             Write current file to {file} and start editing the
  2803.             [count] next file.  {not in Vi}
  2804.  
  2805. :[count]wN[ext][!] [+cmd] [file]            *:wN* *:wNext*
  2806. :[count]wp[revous][!] [+cmd] [file]            *:wp* *:wprevious*
  2807.             Same as :wnext, but go to previous file instead of
  2808.             next.  {not in Vi}
  2809.  
  2810. The [count] in the commands above defaults to one.  For some commands it is
  2811. possible to use two counts.  The last one (rightmost one) is used.
  2812.  
  2813. For [+cmd] see 5.2 |edit_a_file|.
  2814.  
  2815. The wildcards in the argument list are expanded and the filenames are sorted.
  2816. Thus you can use the command "vim *.c" to edit all the C files.  From within
  2817. Vim the command ":n *.c" does the same.  On Unix you can also use backticks,
  2818. for example:
  2819.     :n `find . -name \\*.c -print`
  2820. The backslashes before the star are required to prevent "*.c" to be expanded
  2821. by the shell before executing the find program.
  2822.  
  2823.                             *arglist_quit*
  2824. You are protected from leaving Vim if you have not been editing the last file
  2825. in the argument list.  This prevents you from forgetting that you were editing
  2826. one out of several files.  To exit anyway try to exit twice.  If there are
  2827. changes in the current buffer this will fail.  You can exit anyway, and save
  2828. any changes, with the ":wq!" command.  To lose any changes use the ":q!"
  2829. command.
  2830.  
  2831. When there is an argument list you can see which file you are editing in the
  2832. title of the window (if there is one and 'title' is on) and with the file
  2833. message you get with the "CTRL-G" command.  You will see something like
  2834.     (file 4 of 11)
  2835. If 'shortmess' contains 'f' it will be
  2836.     (4 of 11)
  2837. If you are not really editing the file at the current position in the argument
  2838. list it will be
  2839.     (file (4) of 11)
  2840. This means that you are position 4 in the argument list, but not editing the
  2841. fourth file in the argument list.  This happens when you do ":e file".
  2842.  
  2843.  
  2844. 5.4 Writing and quitting            *write_quit* *save_file*
  2845.  
  2846.                             *:w* *:write*
  2847. :[range]w[rite][!]    Write the specified lines to the current file.
  2848.  
  2849.                             *:w_f* *:write_f*
  2850. :[range]w[rite]    {file}    Write the specified lines to {file}, unless it
  2851.             already exists and the 'writeany' option is off.
  2852.  
  2853.                             *:w!*
  2854. :[range]w[rite]! {file}    Write the specified lines to {file}.  Overwrite an
  2855.             existing file.
  2856.  
  2857.                             *:w_a* *:write_a*
  2858. :[range]w[rite][!] >>    Append the specified lines to the current file.
  2859.  
  2860. :[range]w[rite][!] >> {file}
  2861.             Append the specified lines to {file}.  '!' forces the
  2862.             write even if file does not exist.
  2863.  
  2864.                             *:w_c* *:write_c*
  2865. :[range]w[rite] !{cmd}    Execute {cmd} with [range] lines as standard input
  2866.             (note the space in front of the '!').  {cmd} is
  2867.             executed like with ":!{cmd}", any '!' is replaced with
  2868.             the previous command |:!|.
  2869.  
  2870. The default [range] for the ":w" command is the whole buffer (1,$).
  2871. If a file name is give with ":w" it becomes the alternate file.  This can be
  2872. used when the write fails and you want to try again later with ":w #".
  2873.  
  2874.  
  2875.                             *:q* *:quit*
  2876. :q[uit]            Quit, unless changes have been made or not editing
  2877.             the last file in the argument list.
  2878.  
  2879. :q[uit]!        Quit always, without writing.
  2880.  
  2881. :cq            Quit always, without writing, and return an error
  2882.             code.  Used for Manx's QuickFix mode (see 5.5
  2883.             |quickfix|).
  2884.  
  2885.                             *:wq*
  2886. :wq            Write the current file and exit (unless editing the
  2887.             last file in the argument list or the file is
  2888.             read-only).
  2889.  
  2890. :wq!            Write the current file and exit.
  2891.  
  2892. :wq {file}        Write to {file}.  Exit if not editing the last
  2893.             file in the argument list.
  2894.  
  2895. :wq! {file}        Write to {file} and exit.
  2896.  
  2897. :[range]wq[!] [file]    Same as above, but only write the lines in [range].
  2898.  
  2899.                             *:x* *:xit*
  2900. :[range]x[it][!] [file]
  2901.             Like ":wq", but write only when changes have been
  2902.             made.
  2903.  
  2904.                             *:exi* *:exit*
  2905. :[range]exi[t][!] [file]
  2906.             Same as :xit.
  2907.  
  2908.                             *ZZ*
  2909. ZZ            Write current file, if modified, and exit (same as
  2910.             ":x").  (Note: If there are several windows for the
  2911.             current file, the file is written if it was modified
  2912.             and the window is closed).
  2913.  
  2914.                             *ZQ*
  2915. ZQ            Quit current file and exit (same as ":q!").  (Note: If
  2916.             there are several windows for the current file, only
  2917.             the window is closed).
  2918.  
  2919.                             *timestamp*
  2920. Vim remembers the timestamp of the file when you start editing it.  When you
  2921. write a file the timestamp is checked.  If the file has been changed since you
  2922. started editing it, Vim will ask you if you really want to overwrite the file:
  2923.  
  2924.     WARNING: The file has been changed since reading it!!!
  2925.     Do you really want to write to it (y/n)?
  2926.  
  2927. If you hit 'y' Vim will continue writing the file.  If you hit 'n' the write is
  2928. aborted.  If you used ":wq" or "ZZ" Vim will not exit, you will get another
  2929. chance to write the file.
  2930. The message would normally mean that somebody has written to the file after
  2931. the edit session started.  This could be another person, in which case you
  2932. probably want to check if your changes to the file and the changes from the
  2933. other person should be merged.  Write the file under another name and check for
  2934. differences (the "diff" program can be used for this).
  2935. It is also possible that you modified the file yourself, from another edit
  2936. session or with another command (e.g., a filter command).  Then you will know
  2937. which version of the file you want to keep.
  2938.  
  2939.                             *backup*
  2940. If you write to an existing file (but do not append) while the 'backup',
  2941. 'writebackup' or 'patchmode' option is on, a backup of the original file is
  2942. made.  On Unix systems the file is copied, on other systems the file is
  2943. renamed.  After the file has been successfully written and when the
  2944. 'writebackup' option is on and the 'backup' option is off, the backup file is
  2945. deleted.  When the 'patchmode' option is on the backup file may be renamed.
  2946.  
  2947.                             *backup_table*
  2948. 'backup' 'writebackup'    action
  2949.    off         off    no backup made
  2950.    off         on        backup current file, deleted afterwards (default)
  2951.    on         off    delete old backup, backup current file
  2952.    on         on        delete old backup, backup current file
  2953.  
  2954. When the 'backup' option is on, an old backup file (with the same name as the
  2955. new backup file) will be deleted.  If 'backup' is not set, but 'writebackup' is
  2956. set, an existing backup file will not be deleted.  The backup file that is made
  2957. while the file is being written will have a different name.
  2958.  
  2959. The directories given with the 'backupdir' option is used to put the backup
  2960. file in.  (default: same directory as the written file).
  2961.  
  2962. On Unix systems:
  2963. When you write to an existing file, that file is truncated and then filled
  2964. with the new text.  This means that protection bits, owner and symbolic links
  2965. are unmodified.  The backup file however, is a new file, owned by the user who
  2966. edited the file.  The group of the backup is set to the group of the original
  2967. file.  If this fails, the protection bits for the group are made the same as
  2968. for others.
  2969.  
  2970. If the creation of a backup file fails, the write is not done.  If you want
  2971. to write anyway add a '!' to the command.
  2972.  
  2973.                             *write_fail*
  2974. If the writing of the new file fails, you have to be careful not to lose
  2975. your changes AND the original file.  If there is no backup file and writing
  2976. the new file failed, you have already lost the original file! DON'T EXIT VIM
  2977. UNTIL YOU WRITE OUT THE FILE! If a backup was made, it is put back in place
  2978. of the original file (if possible).  If you exit Vim, and lose the changes
  2979. you made, the original file will mostly still be there.  If putting back the
  2980. original file fails, there will be an error message telling you that you
  2981. lost the original file.
  2982.  
  2983.                             *textmode_write*
  2984. If the 'textmode' option is on <CR><NL> is used for end-of-line.  This is
  2985. default for MS-DOS, Win32 and OS/2.  On other systems the message "[textmode]"
  2986. is shown to remind you that an usual end-of-line marker was used.  If the
  2987. 'textmode' is not set NL is used for end-of-line.  On MS-DOS, Win32 and OS/2
  2988. the message "[notextmode]" is shown.  See also |textmode_io| and the
  2989. 'textmode' and 'textauto' options.
  2990.  
  2991.  
  2992. 5.5 Using the QuickFix mode                *quickfix*
  2993.  
  2994. Vim has a special mode to speedup the edit-compile-edit cycle.  This is
  2995. inspired by the quickfix option of the Manx's Aztec C compiler on the Amiga.
  2996. The idea is to save the error messages from the compiler in a file and use
  2997. Vim to jump to the errors one by one.  You can then examine each problem and
  2998. fix it, without having to remember all the error messages.
  2999.  
  3000. If you are using Manx's Aztec C compiler on the Amiga you should do the
  3001. following:
  3002. - Set the CCEDIT environment variable with the command
  3003.     mset "CCEDIT=vim -e"
  3004. - Compile with the -qf option.  If the compiler finds any errors, Vim is
  3005.   started and the cursor is positioned on the first error.  The error message
  3006.   will be displayed on the last line.  You can go to other errors with the
  3007.   commands mentioned below.  You can fix the errors and write the file(s).
  3008. - If you exit Vim normally the compiler will re-compile the same file.  If you
  3009.   exit with the :cq command, the compiler will terminate.  Do this if you
  3010.   cannot fix the error, or if another file needs to be compiled first.
  3011.  
  3012. If you are using another compiler you should save the error messages in a
  3013. file and start Vim with "vim -e filename".  An easy way to do this is with
  3014. the ":make" command (see below).  The 'errorformat' option should be set to
  3015. match the error messages from your compiler (see below).
  3016.  
  3017. The following commands can be used if you are in QuickFix mode:
  3018.  
  3019.                             *:cc*
  3020. :cc[!] [nr]        Display error [nr].  If [nr] is omitted, the same
  3021.             error is displayed again.  Without [!] this doesn't
  3022.             work when jumping to another buffer, the current buffer
  3023.             has been changed, there is the only window for the
  3024.             buffer and both 'hidden' and 'autowrite' are off.
  3025.             When jumping to another buffer with [!] any changes to
  3026.             the current buffer are lost, unless 'hidden' is set or
  3027.             there is another window for this buffer.  {not in Vi}
  3028.  
  3029.                             *:cn* *:cnext*
  3030. :[count]cn[ext][!]    Display the [count] next error in the list that
  3031.             includes a file name.  If there are no file names at
  3032.             all, go the the [count] next error.  See |:cc| for
  3033.             [!].  {not in Vi}
  3034.  
  3035. :[count]cN[ext][!]            *:cp* *:cprevious* *:cN* *:cNext*
  3036. :[count]cp[revious][!]    Display the [count] previous error in the list that
  3037.             includes a file name.  If there are no file names at
  3038.             all, go the the [count] previous error.  See |:cc| for
  3039.             [!].  {not in Vi}
  3040.  
  3041.                             *:cq* *:cquit*
  3042. :cq[uit]        Quit Vim with an error code, so that the compiler
  3043.             will not compile the same file again.  {not in Vi}
  3044.  
  3045.                             *:cf* *:cfile*
  3046. :cf[ile][!] [errorfile]    Read the error file and jump to the first error.
  3047.             This is done automatically when Vim is started with
  3048.             the -e option.  You can use this command when you
  3049.             keep Vim running while compiling.  If you give the
  3050.             name of the errorfile, the 'errorfile' option will
  3051.             be set to [errorfile].  See |:cc| for [!].  {not in
  3052.             Vi}
  3053.  
  3054.                             *:cl* *:clist*
  3055. :cl[ist]        List all errors that inlcude a file name.  {not in Vi}
  3056.  
  3057. :cl[ist]!        List all errors.  {not in Vi}
  3058.  
  3059.                             *:mak* *:make*
  3060. :mak[e] [arguments]    1. If the 'autowrite' option is on, write any changed
  3061.                buffers
  3062.             2. Any existing 'errorfile' is deleted.
  3063.             3. The program given with the 'makeprg' option is
  3064.                started (default "make") with the optional
  3065.                [arguments] and the output is saved in
  3066.                'errorfile' (for Unix it is also echoed on the
  3067.                screen).
  3068.             4. The 'errorfile' is then read and the first error
  3069.                is jumped to.
  3070.             5. The 'errorfile' is deleted.
  3071.             {not in Vi}
  3072.  
  3073. The name of the file can be set with the 'errorfile' option.  The default is
  3074. "AztecC.Err" for the Amiga and "errors.vim" for other systems.  The format of
  3075. the file from the Aztec compiler is:
  3076.  
  3077.     filename>linenumber:columnnumber:errortype:errornumber:errormessage
  3078.  
  3079.     filename    name of the file in which the error was detected
  3080.     linenumber    line number where the error was detected
  3081.     columnnumber    column number where the error was detected
  3082.     errortype    type of the error, normally a single 'E' or 'W'
  3083.     errornumber    number of the error (for lookup in the manual)
  3084.     errormessage    description of the error
  3085.  
  3086.                             *errorformat*
  3087. Another compiler is likely to use a different format.  You should set the
  3088. 'errorformat' option to a scanf-like string that describes the format.
  3089. First, you need to know how scanf works.  Look in the documentation of your
  3090. C compiler.  Vim will understand eight conversion characters.  Others are
  3091. invalid.
  3092.     %f        file name (finds a string)
  3093.     %l        line number (finds a number)
  3094.     %c        column number (finds a number)
  3095.     %t        error type (finds a single character)
  3096.     %n        error number (finds a number)
  3097.     %m        error message (finds a string)
  3098.     %*<conv>    any scanf non-assignable conversion
  3099.     %%        the single '%' character
  3100.  
  3101. Examples:
  3102. %f>%l:%c:%t:%n:%m"            for the AztecC.Err file
  3103. %f:%l:\ %t%*[^0123456789]%n:\ %m    for Manx/Aztec C error messages
  3104.                     (scanf() doesn't understand [0-9])
  3105. %f\ %l\ %t%*[^0-9]%n:\ %m        for SAS C
  3106. \"%f\"\\,%*[^0-9]%l:\ %m        for generic C compilers
  3107. %f:%l:\ %m                for GCC
  3108. %f(%l)\ :\ %*[^:]:\ %m            old SCO C compiler (pre-OS5)
  3109. %f(%l)\ :\ %t%*[^0-9]%n:\ %m        idem, with error type and number
  3110. %f:%l:\ %m,In\ file\ included\ from\ %f:%l:,\^I\^Ifrom\ %f:%l%m
  3111.                     for GCC, with some extras
  3112.  
  3113. Note the backslash in front of a space and double quote.  It is required for
  3114. the :set command.  There are two backslashes in front of a comma, one for the
  3115. :set command and one to avoid recognizing the comma as a separator of error
  3116. formats.
  3117.  
  3118. The "%f" and "%m" conversions have to detect the end of the string.  They
  3119. should be followed by a character that cannot be in the string.  Everything
  3120. up to that character is included in the string.  Be careful: "%f%l" will
  3121. include everything up to the first '%' in the file name.  If the "%f" or "%m"
  3122. is at the end, everything up to the end of the line is included.
  3123.  
  3124. To be able to detect output from several compilers, several format patterns
  3125. may be put in 'errorformat', separated by commas (note: blanks after the comma
  3126. are ignored).  The first pattern that has a complete match is used.  If no
  3127. match is found, matching parts from the last one will be used, although the
  3128. file name is removed and the error message is set to the whole message.  If
  3129. there is a pattern that may match output from several compilers (but not in a
  3130. right way), put it after one that is more restrictive.  To include a comma in
  3131. a pattern precede it with a backslash (you have to type two in a set command).
  3132. To include a backslash itself give two backslashes (you have to type four in a
  3133. set command).
  3134.  
  3135. If a line is detected that does not completely match the 'errorformat', the
  3136. whole line is put in the error message and the entry is marked "not valid"
  3137. These lines are skipped with the ":cn" and ":cp" commands (unless there is
  3138. no valid line at all).  You can use ":cl!" to display all the error messages.
  3139.  
  3140. If the error format does not contain a file name Vim cannot switch to the
  3141. correct file.  You will have to do this by hand.
  3142.  
  3143. If you have a compiler that produces error messages that do not fit in the
  3144. format string, you could write a program that translates the error messages
  3145. into this format.  You can use this program with the ":make" command by
  3146. changing the 'makeprg' option.  For example:
  3147.     ":set mp=make\ \\\|&\ error_filter".
  3148. The backslashes before the pipe character are required to avoid it to be
  3149. recognized as a command separator.  The backslash before each space is
  3150. required for the set command.
  3151.  
  3152.                         *:make_makeprg*
  3153. The ":make" command executes the command given with the 'makeprg' option.
  3154. This is done by passing the command to the shell given with the 'shell'
  3155. option.  This works almost like typing
  3156.  
  3157.     ":!{makeprg} [arguments] {shellpipe} {errorfile}".
  3158.  
  3159. {makeprg} is the string given with the 'makeprg' option.  Any command can be
  3160. used, not just "make".  Characters '%' and '#' are expanded as usual on a
  3161. command line.  You can use "%<" to insert the current filename without
  3162. extension, for example ":set makeprg=make\ %<.o".
  3163.  
  3164. [arguments] is anything that is typed after ":make".
  3165. {shellpipe} is the 'shellpipe' option.
  3166. {errorfile} is the 'errorfile' option.
  3167.  
  3168. The 'shellpipe' option defaults to ">" for the Amiga, MS-DOS and Win32.  This
  3169. means that the output of the compiler is saved in a file and not shown on the
  3170. screen directly.  For Unix "| tee" is used.  The compiler output is shown on
  3171. the screen and saved in a file the same time.  Depending on the shell used
  3172. "|& tee" or "2>&1| tee" is the default, so stderr output will be included.
  3173.  
  3174. There are some restrictions to the Quickfix mode on the Amiga.  The
  3175. compiler only writes the first 25 errors to the errorfile (Manx's
  3176. documentation does not say how to get more).  If you want to find the others,
  3177. you will have to fix a few errors and exit the editor.  After recompiling,
  3178. up to 25 remaining errors will be found.
  3179.  
  3180. On the Amiga, if Vim was started from the compiler, the :sh and :! commands
  3181. will not work, because Vim is then running in the same process as the
  3182. compiler and these two commands may guru the machine then.
  3183.  
  3184. If you insert or delete lines, mostly the correct error location is still
  3185. found because hidden marks are used (Manx's Z editor does not do this).
  3186. Sometimes, when the mark has been deleted for some reason, the message "line
  3187. changed" is shown to warn you that the error location may not be correct.  If
  3188. you quit Vim and start again the marks are lost and the error locations may
  3189. not be correct anymore.
  3190.  
  3191.  
  3192. 5.6 Editing binary files                *edit_binary*
  3193.  
  3194. Although Vim was made to edit text files, it is possible to edit binary
  3195. files.  The "-b" Vim argument (b for binary) sets some options for
  3196. editing binary files ('binary' on, 'textwidth' to 0, 'textmode' and
  3197. 'textauto' off, 'modeline' off, 'expandtab' off).  Setting the 'binary'
  3198. option has the same effect.  Don't forget to do this before reading the file.
  3199.  
  3200. There are a few things to remember when editing binary files:
  3201. - When editing executable files the number of characters must not change.
  3202.   Use only the "R" or "r" command to change text.  Do not delete characters
  3203.   with "x" or by backspacing.
  3204. - Set the 'textwidth' option to 0.  Otherwise lines will unexpectedly be
  3205.   split in two.
  3206. - When there are not many end-of-line characters, the lines will become very
  3207.   long.  If you want to edit a line that does not fit on the screen reset the
  3208.   'wrap' option.  Horizontal scrolling is used then.  If a line becomes too
  3209.   long (more than about 32767 characters on the Amiga, much more on 32-bit
  3210.   systems, see |limits|) you cannot edit that line.  The line will be split
  3211.   when reading the file.  It is also possible that you get an "out of memory"
  3212.   error when reading the file.
  3213. - Make sure the 'textmode' and 'textauto' options are off before loading the
  3214.   file.  In 'textmode' both <CR><NL> and <NL> are considered to end a line
  3215.   and when the file is written the <NL> will be replaced with <CR><NL>.  The
  3216.   'modelines' option should also be off, because there may be a string like
  3217.   ":vi:" in the file that would give unpredictable results.
  3218. - <Nul> characters are shown on the screen as ^@.  You can enter them with
  3219.   "CTRL-V CTRL-@" or "CTRL-V 000" {Vi cannot handle <Nul> characters in the
  3220.   file}
  3221. - To insert a <NL> character in the file split up a line.  When writing the
  3222.   buffer to a file a <NL> will be written for the end of line.
  3223. - Vim normally appends an end-of-line character at the end of the file if
  3224.   there is none.  Setting the 'binary' option prevents this.  If you want to
  3225.   add the final end-of-line, set the 'endofline' option.  You can also read the
  3226.   value of this option to see if there was an end-of-line character for the
  3227.   last line (you cannot see this in the text).
  3228.  
  3229.  
  3230. 5.7 Automatic commands                    *autocommand*
  3231.  
  3232. You can specify commands to be executed automatically for when reading or
  3233. writing a file, when entering or leaving a buffer or window, and when exiting
  3234. Vim.  For example, 'cindent' can be set for files matching *.c, and unset
  3235. otherwise.  Autocommands can be used to edit compressed files.  These commands
  3236. are normally put in your .vimrc or .exrc file.  {All this is not in Vi}
  3237.  
  3238. WARNING: Using autocommands is very powerful, but may lead to unexpected side
  3239. effects.  Be careful not to destroy your text.
  3240. - It's a good idea to first do some testing on a copy of a file first.  For
  3241.   example: If you use autocommands to decompress a file when starting to edit
  3242.   it, make sure that the autocommands for compressing when writing work
  3243.   correctly.
  3244. - Be prepared for an error halfway through (e.g., disk full).  Vim will mostly
  3245.   be able to undo the changes to the buffer, but you may have to clean up the
  3246.   changes to other files by hand (e.g., compress a file that has been
  3247.   decompressed).
  3248. - If the BufRead* events allow you to edit a compressed file, the FileRead*
  3249.   events should do the same (to be able to do recovery in some rare cases).
  3250.   It's a good idea to use the same autocommands for the File* and Buf* events
  3251.   when possible.
  3252.  
  3253. The autocommand feature is only included if Vim has been compiled with AUTOCMD
  3254. defined.  If the output of ":version" contains "+autocmd" it is included (this
  3255. is the default), if it contains "-autocmd" then the autocommand feature
  3256. doesn't work.
  3257.  
  3258. Note: This command cannot be followed by another command, since any '|' is
  3259. considered part of the command.
  3260.  
  3261.                             *:au* *:autocmd*
  3262. :au[tocmd] {event} {pat} {cmd}
  3263.             Add {cmd} to the list of commands that will be
  3264.             automatically executed on {event} for a file matching
  3265.             {pat}.  It is not added if it is already there (as may
  3266.             happen when .vimrc is sourced again).  The order of
  3267.             entering {cmd} and {pat} is important.
  3268.  
  3269. :au[tocmd] {event} {pat}
  3270.             Show the auto-commands associated with {event} and
  3271.             {pat}.
  3272.  
  3273. :au[tocmd] * {pat}    Show the auto-commands associated with {pat} for all
  3274.             events.
  3275.  
  3276. :au[tocmd] {event}    Show all auto-commands for {event}.
  3277.  
  3278. :au[tocmd]        Show all auto-commands.
  3279.  
  3280. :au[tocmd]! {event} {pat} {cmd}
  3281.             Remove all auto-commands associated with {event} and
  3282.             {pat}, and add the command {cmd}.
  3283.  
  3284. :au[tocmd]! {event} {pat}
  3285.             Remove all auto-commands associated with {event} and
  3286.             {pat}.
  3287.  
  3288. :au[tocmd]! * {pat}    Remove all auto-commands associated with {pat} for all
  3289.             events.
  3290.  
  3291. :au[tocmd]! {event}    Remove ALL auto-commands for {event}.
  3292.  
  3293. :au[tocmd]!        Remove ALL auto-commands.
  3294.  
  3295.                             *:do* *:doautocmd*
  3296. :do[autocmd] {event} [fname]
  3297.             Apply the autocommands matching [fname] (default:
  3298.             current file name) for {event} to the current buffer.
  3299.             This can be used when the current file name does not
  3300.             match the right pattern, after changing settings, or
  3301.             to execute autocommands for a certain event.
  3302.  
  3303.                             *autocommand-events*
  3304. These events are recognized.  Case is ignored, for example "BUFread" and
  3305. "bufread" can be used instead of "BufRead".
  3306.  
  3307.                             *BufNewFile*
  3308. BufNewFile            When starting to edit a file that doesn't
  3309.                 exist.  Can be used to read in a skeleton
  3310.                 file.
  3311.                             *BufReadPre*
  3312. BufReadPre            When starting to edit a new buffer, before
  3313.                 reading the file into the buffer.  Not used
  3314.                 when the file doesn't exist.
  3315.                         *BufRead* *BufReadPost*
  3316. BufRead or BufReadPost        When starting to edit a new buffer, after
  3317.                 reading the file into the buffer, before
  3318.                 executing the modelines.  This does NOT work
  3319.                 for ":r file".  Not used when the file doesn't
  3320.                 exist.
  3321.                             *FileReadPre*
  3322. FileReadPre            Before reading a file with a ":read" command.
  3323.                             *FileReadPost*
  3324. FileReadPost            After reading a file with a ":read" command.
  3325.                 Note that the '[ and '] marks are set to the
  3326.                 first and last line of the read, this can be
  3327.                 used to operate on the just read lines.
  3328.                             *FilterReadPre*
  3329. FilterReadPre            Before reading a file from a filter command.
  3330.                 The file name of the current buffer is used to
  3331.                 match with the pattern, not the name of the
  3332.                 temporary file that is the output of the
  3333.                 filter command.
  3334.                             *FilterReadPost*
  3335. FilterReadPost            After reading a file from a filter command.
  3336.                 Like FilterReadPre, the file name of the
  3337.                 current buffer is used.
  3338.                         *BufWrite* *BufWritePre*
  3339. BufWrite or BufWritePre        Before writing the whole buffer to a file.
  3340.                             *BufWritePost*
  3341. BufWritePost            After writing the whole buffer to a file
  3342.                 (should undo the commands for BufWritePre).
  3343.                             *FileWritePre*
  3344. FileWritePre            Before writing to a file, when not writing the
  3345.                 whole buffer.
  3346.                             *FileWritePost*
  3347. FileWritePost            After writing to a file, when not writing the
  3348.                 whole buffer.
  3349.                             *FileAppendPre*
  3350. FileAppendPre            Before appending to a file.
  3351.                             *FileAppendPost*
  3352. FileAppendPost            After appending to a file.
  3353.                             *FilterWritePre*
  3354. FilterWritePre            Before writing a file for a filter command.
  3355.                 The file name of the current buffer is used to
  3356.                 match with the pattern, not the name of the
  3357.                 temporary file that is the input for the
  3358.                 filter command.
  3359.                             *FilterWritePost*
  3360. FilterWritePost            After writing a file for a filter command.
  3361.                 Like FilterWritePre, the file name of the
  3362.                 current buffer is used.
  3363.                             *BufEnter*
  3364. BufEnter            After entering a buffer.  Useful for setting
  3365.                 options for a file type.  Also executed when
  3366.                 starting to edit a buffer, after the
  3367.                 BufReadPost autocommands.
  3368.                             *BufLeave*
  3369. BufLeave            Before leaving to another buffer.  Also when
  3370.                 leaving or closing the current window and the
  3371.                 new current window is not for the same buffer.
  3372.                             *WinEnter*
  3373. WinEnter            After entering another window.  Not done for
  3374.                 the first window, when Vim is just started.
  3375.                 Useful for setting the window height.
  3376.                 If the window is for another buffer, the
  3377.                 BufEnter autocommands are executed after the
  3378.                 WinEnter autocommands.
  3379.                             *WinLeave*
  3380. WinLeave            Before leaving to another window.  If the
  3381.                 window to be entered is for a different
  3382.                 buffer, the BufLeave autocommands are executed
  3383.                 before the WinLeave autocommands.
  3384.                             *VimLeave*
  3385. VimLeave            Before exiting Vim, just before writing the
  3386.                 .viminfo file.  There is no VimEnter event,
  3387.                 because you can use the .vimrc for that.
  3388.  
  3389. For READING FILES there are three possible pairs of events, only one pair is
  3390. used at a time:
  3391. BufNewFile            starting to edit a non-existant file
  3392. BufReadPre    BufReadPost    starting to edit an existing file
  3393. FilterReadPre    FilterReadPost    read the temp file with filter output
  3394. FileReadPre    FileReadPost    any other file read
  3395.  
  3396. Note that the autocommands for the *ReadPre and *Filter* events are not
  3397. allowed to change the current buffer.  You will get an error message if this
  3398. happens anyway.  This is to prevent the file to be read into the wrong buffer.
  3399.  
  3400. Before the *ReadPre event the '[ mark is set to the line just above where the
  3401. new lines will be inserted.
  3402. Before the *ReadPost event the '[ mark is set to the first line that was just
  3403. read, the '] mark to the last line.
  3404. Careful: '[ and '] will change when using commands that change the buffer.
  3405.  
  3406. "<afile>" can be used for the file name that is being read, in commands where
  3407. a file name is expected (where you can also use "%" for the current file
  3408. name) |:<afile>|.
  3409.  
  3410. Examples for reading compressed files:
  3411.   :autocmd! BufReadPre,FileReadPre   *.gz set bin
  3412.   :autocmd  BufReadPost,FileReadPost *.gz '[,']!gunzip
  3413.   :autocmd  BufReadPost,FileReadPost *.gz set nobin
  3414.  
  3415. NOTE: When using the examples given, any existing autocommands for the same
  3416. event/pattern combination will be removed, because of the '!'.
  3417.  
  3418. For WRITING FILES there are four possible pairs of events, only one pair is
  3419. used at a time:
  3420. BufWritePre    BufWritePost    writing the whole buffer
  3421. FilterWritePre    FilterWritePost    writing to the temp file with filter input
  3422. FileAppendPre    FileAppendPost    appending to a file
  3423. FileWritePre    FileWritePost    any other file write
  3424.  
  3425. Note that the *WritePost commands should undo any changes to the buffer that
  3426. were caused by the *WritePre commands, otherwise writing the file will have
  3427. the side effect of changing the buffer.
  3428.  
  3429. Before executing the autocommands, the buffer from where the lines are to be
  3430. written is temporarily made the current buffer.  Unless the autocommands
  3431. change the current buffer, or delete the previously current buffer, the
  3432. previously current buffer is made the current buffer again.
  3433.  
  3434. The *WritePre and *AppendPre autocommands must not delete the buffer from
  3435. where the lines are to be written.
  3436.  
  3437. Before executing the *WritePre and *AppendPre autocommands the '[ mark is set
  3438. to the first line that will be written, the '] mark to the last line.
  3439. Careful: '[ and '] will change when using commands that change the buffer.
  3440.  
  3441. "<afile>" can be used for the file name that is being written, in commands
  3442. where a file name is expected (where you can also use "%" for the current file
  3443. name) |:<afile>|.
  3444.  
  3445. Examples for writing compressed files:
  3446.   :autocmd! BufWritePost,FileWritePost    *.gz !mv <afile> <afile>:r
  3447.   :autocmd  BufWritePost,FileWritePost    *.gz !gzip <afile>:r
  3448.  
  3449.   :autocmd! FileAppendPre        *.gz !gunzip <afile>
  3450.   :autocmd  FileAppendPre        *.gz !mv <afile>:r <afile>
  3451.   :autocmd! FileAppendPost        *.gz !mv <afile> <afile>:r
  3452.   :autocmd  FileAppendPost        *.gz !gzip <afile>:r
  3453.  
  3454. ("<afile>:r" is the file name without the extension, see |:_%:|)
  3455.  
  3456. The commands executed for the BufNewFile, BufRead/BufReadPost, BufWritePost,
  3457. FileAppendPost and VimLeave events do not set or reset the changed flag of the
  3458. buffer.  When you decompress the buffer with the BufReadPost autocommands, you
  3459. can still exit with ":q".  When you use ":undo" in BufWritePost to undo the
  3460. changes made by BufWritePre commands, you can still do ":q" (this also makes
  3461. "ZZ" work).
  3462.  
  3463. To execute Normal mode commands from an autocommand, use the ":normal"
  3464. command.  Use with care!  If the Normal mode command is not finished, the user
  3465. needs to type characters (e.g., after ":normal m" you need to type a mark
  3466. name).
  3467.  
  3468. If you want the buffer not to be modified after changing it, reset the
  3469. 'modified' option.  This makes it possible to exit the buffer with ":q"
  3470. instead of ":q!".
  3471.  
  3472. Autocommands do not nest.  If you use ":r" or ":w" in an autocommand, the
  3473. BufRead and BufWrite autocommands are not executed for those commands.  It's
  3474. also not possible to use the ":au" command in an autocommand (that could be a
  3475. self-modifying command!).
  3476.  
  3477. There is currently no way to disable the autocommands.  If you want to write a
  3478. file without executing the autocommands for that type of file, write it under
  3479. another name and rename it with a shell command.
  3480.  
  3481. Note: When reading a file (with ":read file" or with a filter command) and the
  3482. last line in the file does not have an end-of-line character, this is
  3483. remembered.  At the next write (with ":write file" or with a filter command),
  3484. if the same line is written again as the last line in a file AND 'binary' is
  3485. set, no end-of-line character is written.  This makes a filter command on the
  3486. just read lines write the same file as was read, and makes a write command on
  3487. just filtered lines write the same file as was read from the filter.  For
  3488. example, another way to write a compressed file:
  3489.  
  3490.   :autocmd FileWritePre *.gz   set bin|'[,']!gzip
  3491.   :autocmd FileWritePost *.gz  undo|set nobin
  3492.  
  3493.                             *autocommand-pattern*
  3494. Multiple patterns may be given separated by commas.  Here are some examples:
  3495.  
  3496.   :autocmd BufRead   *        set tw=79 nocin ic infercase fo=2croq
  3497.   :autocmd BufRead   .letter    set tw=72 fo=2tcrq
  3498.   :autocmd BufEnter  .letter    set dict=/usr/lib/dict/words
  3499.   :autocmd BufLeave  .letter    set dict=
  3500.   :autocmd BufRead,BufNewFile   *.c,*.h    set tw=0 cin noic
  3501.   :autocmd BufEnter  *.c,*.h    abbr FOR for(i = 0; i < 3; i++)^M{^M}^[O
  3502.   :autocmd BufLeave  *.c,*.h    unabbr FOR
  3503.  
  3504. For makefiles (makefile, Makefile, imakefile, makefile.unix, etc.):
  3505.  
  3506.   :autocmd BufEnter  ?akefile*    set include=^s\=include
  3507.   :autocmd BufLeave  ?akefile*    set include&
  3508.  
  3509. To always start editing C files at the first function:
  3510.  
  3511.   :autocmd BufRead   *.c,*.h    1;/^{
  3512.  
  3513. Without the "1;" above, the search would start from wherever the file was
  3514. entered, rather than from the start of the file.
  3515.  
  3516. To read a skeleton file for new C files:
  3517.  
  3518.   :autocmd BufNewFile  *.c    0r ~/.skeleton.c
  3519.   :autocmd BufNewFile  *.h    0r ~/.skeleton.h
  3520.  
  3521. To insert the current date and time in a *.html file when writing it:
  3522.  
  3523. :autocmd BufWritePre,FileWritePre *.html ks|1,20g/Last modification: /normal f:lD:read !date^MkJ's
  3524.  
  3525. (to insert the ^M type CTRL-V CTRL-M)
  3526. You need to have a line "Last modification: <date time>" in the first 20 lines
  3527. of the file for this to work.  The <date time> (and anything in the same line
  3528. after it) will be replaced with the current date and time.  Explanation:
  3529.     ks        mark current position with mark 's'
  3530.     1,20g/pattern/    find lines that contain the pattern
  3531.     normal f:    find the ':'
  3532.     lD        delete the old date and time
  3533.     !date^M        read the current date and time into the next line
  3534.     kJ        Join the date and time with the previous line
  3535.     's        return the cursor to the old position
  3536.  
  3537. When entering :autocmd on the command line, completion of events and command
  3538. names may be done (with <Tab>, CTRL-D, etc.) where appropriate.
  3539.  
  3540. All matching auto-commands will be executed in the order that they were
  3541. specified.  It is recommended that your first auto-command be used for all
  3542. files by using "*" as the file pattern.  This means that you can define
  3543. defaults you like here for any settings, and if there is another matching
  3544. auto-command it will override these.  But if there is no other matching
  3545. auto-command, then at least your default settings are recovered (if entering
  3546. this file from another for which auto-commands did match).  Note that "*" will
  3547. also match files starting with ".", unlike Unix shells.
  3548.  
  3549. Normally the file pattern is tested for a match against just the tail part of
  3550. the file name (without its leading directory path), but if a path separator
  3551. character (eg '/' on Unix) appears in the pattern, then it will be tested
  3552. against the full file name.  For example:
  3553.  
  3554.   :autocmd BufRead */vim/src/*    set wrap
  3555.  
  3556. Note that using ~ in a file name (for home directory) doesn't work.  Use a
  3557. pattern that matches the full path name, for example "*home/user/.cshrc".
  3558.  
  3559.  
  3560. 6. Cursor motions                    *cursor_motions*
  3561. =================
  3562.  
  3563. These commands move the cursor position.  If the new position is off of the
  3564. screen, the screen is scrolled to show the cursor (see also 'scrolljump' and
  3565. 'scrolloff' options).
  3566.  
  3567.                             *operator*
  3568. The motion commands can be used after an operator command, to have the command
  3569. operate on the text that was moved over.  That is the text between the cursor
  3570. position before and after the motion.  Operators are generally used to delete
  3571. or change text.  The following operators are available:
  3572.     |c|    c    change
  3573.     |d|    d    delete
  3574.     |y|    y    yank into register (does not change the text)
  3575.     |~|    ~    swap case (only if 'tildeop' is set)
  3576.     |g~|    g~    swap case
  3577.     |gu|    gu    make lower case
  3578.     |gU|    gU    make upper case
  3579.     |!|    !    filter through an external program
  3580.     |=|    =    filter through 'equalprg' or C-indenting if empty
  3581.     |Q|    Q    text formatting (obsolete)
  3582.     |gq|    gq    text formatting
  3583.     |>|    >    shift right
  3584.     |<|    <    shift left
  3585. If the motion includes a count and the operator also had a count before it,
  3586. the two counts are multiplied.  For example: "2d3w" deletes six words.
  3587.     The operator either affects whole lines, or the characters between the
  3588. start and end position.  Generally, motions that move between lines affect
  3589. lines (are linewise), and motions that move within a line affect characters.
  3590. However, there are some exceptions.
  3591.     A character motion is either inclusive or exclusive. When inclusive,
  3592. the start and end position of the motion are included in the operation.
  3593. When exclusive, the last character towards the end of the buffer is not
  3594. included.  Linewise motions always include the start and end position.
  3595.     Which motions are linewise, inclusive or exclusive is mentioned
  3596. below.  There are however, two general exceptions:
  3597. 1. If the motion is exclusive and the end of the motion is in column 1, the
  3598.    end of the motion is moved to the end of the previous line and the motion
  3599.    becomes inclusive.  Example: "}" ends at the first line after a paragraph,
  3600.    but "V}" will not include that line.
  3601. 2. If the motion is exclusive, the end of the motion is in column 1 and the
  3602.    start of the motion was at or before the first non-blank in the line, the
  3603.    motion becomes linewise.  Example: If a paragraph begins with some blanks
  3604.    and you do "d}" while standing on the first non-blank, all the lines of
  3605.    the paragraph are deleted, including the blanks.  If you do a put now, the
  3606.    deleted lines will be inserted below the cursor position.
  3607.  
  3608. Instead of first giving the operator and then a motion you can use Visual
  3609. mode: mark the start of the text with "v", move the cursor to the end of the
  3610. text that is to be affected and then hit the operator.  The text between the
  3611. start and the cursor position is highlighted, so you can see what text will
  3612. be operated upon.  This allows much more freedom, but requires more key
  3613. strokes and has limited redo functionality.  See the chapter on Visual mode
  3614. |Visual_mode|.
  3615.  
  3616. If you want to know where you are in the file use the "CTRL-G" command
  3617. |CTRL-G| or the "g CTRL-G command |g_CTRL-G|.  If you set the 'ruler' option,
  3618. the cursor position is continuously shown in the status line (which slows down
  3619. Vim a little).
  3620.  
  3621. NOTE: Experienced users prefer the hjkl keys because they are always right
  3622. under their fingers.  Beginners often prefer the arrow keys, because they
  3623. do not know what the hjkl keys do.  The mnemonic value of hjkl is clear from
  3624. looking at the keyboard.  Think of j as an arrow pointing downwards.
  3625.  
  3626.  
  3627. 6.1 Left-right motions                    *left_right_motions*
  3628.  
  3629. h        or                    *h*
  3630. <Left>        or                    *<Left>*
  3631. CTRL-H        or                    *CTRL-H* *<BS>*
  3632. <BS>            [count] characters to the left (exclusive).
  3633.             Note: If you prefer <BS> to delete a character, use
  3634.             the mapping:
  3635.                 :map CTRL-V<BS>        X
  3636.             (to enter "CTRL-V<BS>" type the CTRL-V key, followed
  3637.             by the <BS> key)
  3638.             See |:fixdel| if the <BS> key does not do what you
  3639.             want.
  3640.  
  3641. l        or                    *l*
  3642. <Right>        or                    *<Right>* *<Space>*
  3643. <Space>            [count] characters to the right (exclusive).
  3644.  
  3645.                             *0*
  3646. 0            To the first character of the line (exclusive).  When
  3647.             moving up or down, stay in same screen column (if
  3648.             possible).
  3649.  
  3650.                             *<Home>*
  3651. <Home>            To the first character of the line (exclusive).  When
  3652.             moving up or down, stay in same text column (if
  3653.             possible).  Works like "1|", which differs from "0"
  3654.             when the line starts with a <Tab>.  {not in Vi}
  3655.  
  3656.                             *^*
  3657. ^            To the first non-blank character of the line
  3658.             (exclusive).
  3659.  
  3660.                             *$* *<End>*
  3661. $  or <End>        To the end of line and [count - 1] lines downward
  3662.             (inclusive).
  3663.  
  3664.                             *g0* *g<Home>*
  3665. g0 or g<Home>        When lines wrap ('wrap on): To the first character of
  3666.             the screen line (exclusive).  Differs from "0" when a
  3667.             line is wider than the screen.
  3668.             When lines don't wrap ('wrap' off): To the leftmost
  3669.             character of the current line that is on the screen.
  3670.             Differs from "0" when the first character of the line
  3671.             is not on the screen.  {not in Vi}
  3672.  
  3673.                             *g^*
  3674. g^            When lines wrap ('wrap' on): To the first non-blank
  3675.             character of the screen line (exclusive).  Differs
  3676.             from "^" when a line is wider than the screen.
  3677.             When lines don't wrap ('wrap' off): To the leftmost
  3678.             non-blank character of the current line that is on the
  3679.             screen.  Differs from "^" when the first non-blank
  3680.             character of the line is not on the screen.  {not in
  3681.             Vi}
  3682.  
  3683.                             *g$* *g<End>*
  3684. g$ or g<End>        When lines wrap ('wrap' on): To the last character of
  3685.             the screen line and [count - 1] screen lines downward
  3686.             (inclusive).  Differs from "$" when a line is wider
  3687.             than the screen.
  3688.             When lines don't wrap ('wrap' off): To the righmost
  3689.             character of the current line that is visible on the
  3690.             screen.  Differs from "$" when the last character of
  3691.             the line is not on the screen or when a count is used.
  3692.             {not in Vi}
  3693.  
  3694.                             *bar*
  3695. |            To screen column [count] in the current line
  3696.             (exclusive).
  3697.  
  3698.                             *f*
  3699. f{char}            To [count]'th occurrence of {char} to the right.  The
  3700.             cursor is placed on {char} (inclusive).
  3701.  
  3702.                             *F*
  3703. F{char}            To the [count]'th occurrence of {char} to the left.
  3704.             The cursor is placed on {char} (inclusive).
  3705.  
  3706.                             *t*
  3707. t{char}            Till before [count]'th occurrence of {char} to the
  3708.             right.  The cursor is placed on the character left of
  3709.             {char} (inclusive).
  3710.  
  3711.                             *T*
  3712. T{char}            Till after [count]'th occurrence of {char} to the
  3713.             left.  The cursor is placed on the character right of
  3714.             {char} (inclusive).
  3715.  
  3716.                             *;*
  3717. ;            Repeat latest f, t, F or T [count] times.
  3718.  
  3719.                             *,*
  3720. ,            Repeat latest f, t, F or T in opposite direction
  3721.             [count] times.
  3722.  
  3723. These commands move the cursor to the specified column in the current line.
  3724. They stop at the first column and at the end of the line, except "$", which
  3725. may move to one of the next lines.  See 'whichwrap' option to make some of the
  3726. commands move accross line boundaries.
  3727.  
  3728.  
  3729. 6.2 Up-down motions                    *up_down_motions*
  3730.  
  3731. k        or                    *k*
  3732. <Up>        or                    *<Up>* *CTRL-P*
  3733. CTRL-P            [count] lines upward (linewise).
  3734.  
  3735. j        or                    *j*
  3736. <Down>        or                    *<Down>*
  3737. CTRL-J        or                    *CTRL-J*
  3738. <NL>        or                    *<NL>* *CTRL-N*
  3739. CTRL-N            [count] lines downward (linewise).
  3740.  
  3741. gk        or                    *gk* *g<Up>*
  3742. g<Up>            [count] display lines upward (exclusive).  Differs
  3743.             from 'k' when lines wrap.  {not in Vi}
  3744.  
  3745. gj        or                    *gj* *g<Down>*
  3746. g<Down>            [count] display lines downward (exclusive).  Differs
  3747.             from 'j' when lines wrap.  {not in Vi}
  3748.  
  3749.                             *-*
  3750. -  <minus>        [count] lines upward, on the first non-blank
  3751.             character (linewise).
  3752.  
  3753. +        or                    *+*
  3754. CTRL-M        or                    *CTRL-M* *<CR>*
  3755. <CR>            [count] lines downward, on the first non-blank
  3756.             character (linewise).
  3757.  
  3758.                             *_*
  3759. _  <underscore>        [count] - 1 lines downward, on the first non-blank
  3760.             character (linewise).
  3761.  
  3762. <C-End>        or                    *G* *<C-End>*
  3763. G            Goto line [count], default last line, on the first
  3764.             non-blank character (linewise).  If 'startofline' not
  3765.             set, keep the same column.
  3766.  
  3767. <C-Home>    or                    *gg* *<C-Home>*
  3768. gg            Goto line [count], default first line, on the first
  3769.             non-blank character (linewise).  If 'startofline' not
  3770.             set, keep the same column.
  3771.  
  3772. :[range]        Set the cursor on the (last) specified line number
  3773.             (cannot be used with an operator).
  3774.  
  3775.                             *N%*
  3776. {count}%        Go to {count} percentage in the file, on the first
  3777.             non-blank in the line (linewise).  To compute the new
  3778.             line number this formula is used: {count} *
  3779.             number-of-lines / 100.  See also 'startofline'
  3780.             option.  {not in Vi}
  3781.  
  3782. These commands move to the specified line.  They stop when reaching the first
  3783. or the last line.  The first two commands put the cursor in the same column
  3784. (if possible) as it was after the last command that changed the column,
  3785. except after the "$" command, then the cursor will be put on the last
  3786. character of the line.
  3787.  
  3788.  
  3789. 6.3 Word motions                    *word_motions*
  3790.  
  3791. <S-Right>    or                    *<S-Right>* *w*
  3792. w            [count] words forward (exclusive).
  3793.  
  3794.                             *W*
  3795. W            [count] WORDS forward (exclusive).
  3796.  
  3797.                             *e*
  3798. e            Forward to the end of word [count] (inclusive).
  3799.  
  3800.                             *E*
  3801. E            Forward to the end of WORD [count] (inclusive).
  3802.  
  3803. <S-Left>    or                    *<S-Left>* *b*
  3804. b            [count] words backward (exclusive).
  3805.  
  3806.                             *B*
  3807. B            [count] WORDS backward (exclusive).
  3808.  
  3809.                             *ge*
  3810. ge            Backward to the end of word [count] (inclusive).
  3811.  
  3812.                             *gE*
  3813. gE            Backward to the end of WORD [count] (inclusive).
  3814.  
  3815. These commands move over words or WORDS.
  3816.                             *word*
  3817. A word consists of a sequence of letters, digits and underscores, or a
  3818. sequence of other non-blank characters, separated with white space (spaces,
  3819. tabs, end of line).  This can be changed with the 'iskeyword' option.
  3820.                             *WORD*
  3821. A WORD consists of a sequence of non-blank characters, separated with white
  3822. space.  An empty line is also considered to be a word and a WORD.
  3823.  
  3824. Special case: "cw" and "cW" are treated like "ce" and "cE" if the cursor is
  3825. on a non-blank.  This is because "cw" is interpreted as change-word, and a
  3826. word does not include the following white space.  {Vi: "cw" when on a blank
  3827. followed by other blanks changes only the first blank; this is probably a
  3828. bug, because "dw" deletes all the blanks}
  3829.  
  3830. Another special case: When using the "w" motion in combination with an
  3831. operator and the last word moved over is at the end of a line, the end of
  3832. that word becomes the end of the operated text, not the first word in the
  3833. next line.
  3834.  
  3835. The original Vi implementation of "e" is buggy.  For example, the "e" command
  3836. will stop on the first character of a line if the previous line was empty.
  3837. But when you use "2e" this does not happen.  In Vim "ee" and "2e" are the
  3838. same, which is more logical.  However, this causes a small incompatibility
  3839. between Vi and Vim.
  3840.  
  3841.  
  3842. 6.4 Text object motions                    *object_motions*
  3843.  
  3844.                             *(*
  3845. (            [count] sentences backward (exclusive).
  3846.  
  3847.                             *)*
  3848. )            [count] sentences forward (exclusive).
  3849.  
  3850.                             *{*
  3851. {            [count] paragraphs backward (exclusive).
  3852.  
  3853.                             *}*
  3854. }            [count] paragraphs forward (exclusive).
  3855.  
  3856.                             *]]*
  3857. ]]            [count] sections forward or to the next '{' in the
  3858.             first column.  When used after an operator, then the
  3859.             '}' in the first column.  (linewise).
  3860.  
  3861.                             *][*
  3862. ][            [count] sections forward or to the next '}' in the
  3863.             first column (linewise).
  3864.  
  3865.                             *[[*
  3866. [[            [count] sections backward or to the previous '{' in
  3867.             the first column (linewise).
  3868.  
  3869.                             *[]*
  3870. []            [count] sections backward or to the previous '}' in
  3871.             the first column (linewise).
  3872.  
  3873. These commands move over three kinds of text objects.
  3874.  
  3875.                             *sentence*
  3876. A sentence is defined as ending at a '.', '!' or '?' followed by either the
  3877. end of a line, or by a space.  {Vi: two spaces} Any number of closing ')',
  3878. ']', '"' and ''' characters my appear after the '.', '!' or '?' before the
  3879. spaces or end of line.  A paragraph and section boundary is also a sentence
  3880. boundary.
  3881.  
  3882.                             *paragraph*
  3883. A paragraph begins after each empty line, and also at each of a set of
  3884. paragraph macros, specified by the pairs of characters in the 'paragraphs'
  3885. option.  The default is "IPLPPPQPP LIpplpipbp", which corresponds to the
  3886. macros ".IP", ".LP", etc.  (These are nroff macros, so the dot must be in the
  3887. first column).  A section boundary is also a paragraph boundary.  Note that
  3888. this does not include a '{' or '}' in the first column.
  3889.  
  3890.                             *section*
  3891. A section begins after a form-feed (<C-L>) in the first column and at each of
  3892. a set of section macros, specified by the pairs of characters in the
  3893. 'sections' option.  The default is "SHNHH HUnhsh".
  3894.  
  3895. The "]" and "[" commands stop at the '{' or <}" in the first column.  This is
  3896. useful to find the start or end of a function in a C program.  Note that the
  3897. first character of the command determines the search direction and the
  3898. second character the type of brace found.
  3899.  
  3900.  
  3901. 6.5 Text object selection                *object_select*
  3902.  
  3903.                             *v_a*
  3904. a            select [count] words (see |word|).  {not in Vi}
  3905.  
  3906.                             *v_A*
  3907. A            select [count] WORDS (see |WORD|).  {not in Vi}
  3908.  
  3909.                             *v_s*
  3910. s            select [count] sentences (see |sentence|).  {not in Vi}
  3911.  
  3912.                             *v_p*
  3913. p            select [count] paragraphs (see |paragraph|).  {not in
  3914.             Vi}
  3915.  
  3916.                             *v_S*
  3917. S            select [count] blocks, from "[count] [(" to the
  3918.             matching ')' (see |[(|).  {not in Vi}
  3919.  
  3920.                             *v_P*
  3921. P            select [count] blocks, from "[count] [{" to the
  3922.             matching '}' (see |[{|).  {not in Vi}
  3923.  
  3924. These object selection commands can only be used in Visual mode and after an
  3925. operator.
  3926.  
  3927. When used after an operator:
  3928. For non-block objects:
  3929.     The operator applies to the object and the white space after the
  3930.     object.  If there is no white space after the object or when the
  3931.     cursor was in the white space before the object, the white space
  3932.     before the object is included.
  3933. For a block object:
  3934.     The operator applies to the block excluding the surrounding braces.
  3935.     If the cursor was on one of the braces (or on the indent before '{' or
  3936.     '}) they are included.
  3937.  
  3938. When used in Visual mode:
  3939. When start and end of the Visual area are the same (just after typing "v"):
  3940.     One object is selected, the same as for using an operator.
  3941. When start and end of the Visual area are not the same:
  3942.     For non-block objects the area is extended by one object or the white
  3943.     space up to the next object.  The direction in which this happens
  3944.     depends on which side of the Visual area the cursor is.  For the block
  3945.     objects the block is extended one level outwards.
  3946.  
  3947. For illustration, here is a list of delete commands, grouped from small to big
  3948. objects.  Note that for a single character and a whole line the existing vi
  3949. movement commands are used.
  3950.     "dl"    delete character (alias: "x")        |dl|
  3951.     "da"    delete word                *da*
  3952.     "dA"    delete WORD (see |WORD|)        *dA*
  3953.     "dd"    delete line                |dd|
  3954.     "ds"    delete sentence                *ds*
  3955.     "dS"    delete '(' ')' block            *dS*
  3956.     "dp"    delete paragraph            *dp*
  3957.     "dP"    delete '{' '}' block            *dP*
  3958.  
  3959. Note the difference between using a movement command and an object.  The
  3960. movement command operates from here (cursor position) to where the movement
  3961. takes us.  When using an object the whole object is operated upon, no matter
  3962. where on the object the cursor is.  For example, compare "dw" and "da": "dw"
  3963. deletes from the cursor position to the start of the next word, "da" deletes
  3964. the word under the cursor and the space after or before it.
  3965.  
  3966.  
  3967. 6.6 Pattern searches                    *pattern_searches*
  3968.  
  3969.                             */*
  3970. /{pattern}[/]<CR>    Search forward for the [count]'th occurrence of
  3971.             {pattern} (exclusive).
  3972.  
  3973. /{pattern}/{offset}<CR>    Search forward for the [count]'th occurrence of
  3974.             {pattern} and go {offset} lines up or down (see
  3975.             below).  (linewise).
  3976.  
  3977.                             */<CR>*
  3978. /<CR>            Search forward for the [count]'th latest used
  3979.             pattern with latest used {offset}.
  3980.  
  3981. //{offset}<CR>        Search forward for the [count]'th latest used
  3982.             pattern with new {offset}.  If {offset} is empty no
  3983.             offset is used.
  3984.  
  3985.                             *?*
  3986. ?{pattern}[?]<CR>    Search backward for the [count]'th previous
  3987.             occurrence of {pattern} (exclusive).
  3988.  
  3989. ?{pattern}?{offset}<CR>    Search backward for the [count]'th previous
  3990.             occurrence of {pattern} and go {offset} lines up or
  3991.             down (see below) (linewise).
  3992.  
  3993.                             *?<CR>*
  3994. ?<CR>            Search backward for the [count]'th latest used
  3995.             pattern with latest used {offset}.
  3996.  
  3997. ??{offset}<CR>        Search backward for the [count]'th latest used
  3998.             pattern with new {offset}.  If {offset} is empty no
  3999.             offset is used.
  4000.  
  4001.                             *n*
  4002. n            Repeat the latest "/" or "?" [count] times.  {Vi: no
  4003.             count}
  4004.  
  4005.                             *N*
  4006. N            Repeat the latest "/" or "?" [count] times in
  4007.             opposite direction.  {Vi: no count}
  4008.  
  4009.                             *star*
  4010. *            Search forward for the [count]'th occurrence of the
  4011.             word nearest to the cursor.  The word used for the
  4012.             search is the first of:
  4013.                 1. the keyword under the cursor |'iskeyword'|
  4014.                 2. the first keyword after the cursor, in the
  4015.                    current line
  4016.                 3. the non-blank word under the cursor
  4017.                 4. the first non-blank word after the cursor,
  4018.                    in the current line
  4019.             Only whole keywords are searched for, like with the
  4020.             command "/\<keyword\>".  (exclusive)  {not in Vi}
  4021.  
  4022.                             *#*
  4023. #            Same as "*", but search backward.  The English pound
  4024.             sign (character 163) also works.  If the "#" key works
  4025.             as backspace, try using "stty erase <BS>" before
  4026.             starting Vim (<BS> is CTRL-H or a real backspace).
  4027.             {not in Vi}
  4028.  
  4029.                             *gstar*
  4030. g*            Like "*", but don't put "\<" and "\>" around the word.
  4031.             This makes the search also find matches that are not a
  4032.             whole word.  {not in Vi}
  4033.  
  4034.                             *g#*
  4035. g#            Like "#", but don't put "\<" and "\>" around the word.
  4036.             This makes the search also find matches that are not a
  4037.             whole word.  {not in Vi}
  4038.  
  4039.                             *gd*
  4040. gd            Goto local Declaration.  When the cursor is on a local
  4041.             variable, this command will jump to its declaration.
  4042.             First a search is made for the end of the previous
  4043.             function, just like "[]".  If it is not found the
  4044.             search stops in line 1.  From this position a search is
  4045.             made for the keyword under the cursor, like with "*",
  4046.             but lines that look like a comment are ignored (see
  4047.             'comments' option).  Note that this is not guaranteed
  4048.             to work, Vim does not really check the syntax, it only
  4049.             searches for a match with the keyword.  If included
  4050.             files also need to be searched use the commands listed
  4051.             in |include_search|.  {not in Vi}
  4052.  
  4053.                             *gD*
  4054. gD            Goto global Declaration.  When the cursor is on a
  4055.             global variable that is defined in the file, this
  4056.             command will jump to its declaration.  This works just
  4057.             like "gd", except that the search for the keyword
  4058.             always starts in line 1.  {not in Vi}
  4059.  
  4060.                             *CTRL-C*
  4061. CTRL-C            Interrupt current (search) command.
  4062.  
  4063. While typing the search pattern the current match will be shown if the
  4064. 'incsearch' option is on.  Remember that you still have to finish the search
  4065. command with <CR> to actually position the cursor at the displayed match.  Or
  4066. use <Esc> to abandon the search.
  4067.  
  4068. These commands search for the specified pattern.  With "/" and "?" an
  4069. additional offset may be given.  There are two types of offsets: line offsets
  4070. and character offsets.  {the character offsets are not in Vi}
  4071.  
  4072.                             *search_offset*
  4073. The offset gives the cursor position relative to the found match:
  4074.     [num]    [num] lines downwards, in column 1
  4075.     +[num]    [num] lines downwards, in column 1
  4076.     -[num]    [num] lines upwards, in column 1
  4077.     e[+num]    [num] characters to the right of the end of the match
  4078.     e[-num]    [num] characters to the left of the end of the match
  4079.     s[+num]    [num] characters to the right of the start of the match
  4080.     s[-num]    [num] characters to the left of the start of the match
  4081.     b[+num]    [num] characters to the right of the start (begin) of the match
  4082.     b[-num]    [num] characters to the left of the start (begin) of the match
  4083.  
  4084. If a '-' or '+' is given but [num] is omitted, a count of one will be used.
  4085. When including an offset with 'e', the search becomes inclusive (the
  4086. character the cursor lands on is included in operations).
  4087.  
  4088. Examples:
  4089.  
  4090. pattern            cursor position
  4091. /test/+1        one line below "test", in column 1
  4092. /test/e            on the last t of "test"
  4093. /test/s+2        on the 's' of "test"
  4094. /test/b-3        three characters before "test"
  4095.  
  4096. If one of these commands is used after an operator, the characters between
  4097. the cursor position before and after the search is affected.  However, if a
  4098. line offset is given, the whole lines between the two cursor positions are
  4099. affected.
  4100.  
  4101.                             *//;*
  4102. A very special offset is ';' followed by another search command.  For example:
  4103.  
  4104.     /test 1/;/test
  4105.     /test.*/+1;?ing?
  4106.  
  4107. The first one first finds the next occurence of "test 1", and then the first
  4108. occurence of "test" after that.
  4109.  
  4110. This is like executing two search commands after each other, except that:
  4111. - It can be used as a single motion command after an operator.
  4112. - The direction for a following "n" or "N" command comes from the first
  4113.   search command.
  4114. - When an error occurs the cursor is not moved at all.
  4115.  
  4116. The last used <pattern> and <offset> are remembered.  They can be used to
  4117. repeat the search, possibly in another direction or with another count.  Note
  4118. that two patterns are remembered: one for 'normal' search commands and one
  4119. for the substitute command ":s".  Each time an empty <pattern> is given, the
  4120. previously used <pattern> is used.
  4121.  
  4122. In Vi the ":tag" command sets the last search pattern when the tag is searched
  4123. for.  In Vim this is not done, the previous search pattern is still remembered,
  4124. unless the 't' flag is present in 'cpoptions'.  The search pattern is always
  4125. put in the search history.
  4126.  
  4127. If the 'wrapscan' option is on (which is the default), searches wrap around
  4128. the end of the buffer.  If 'wrapscan' is not set, the backward search stops
  4129. at the beginning and the forward search stops at the end of the buffer.  If
  4130. 'wrapscan' is set and the pattern was not found the error message "pattern
  4131. not found" is given, and the cursor will not be moved.  If 'wrapscan' is not
  4132. set the message becomes "search hit BOTTOM without match" when searching
  4133. forward, or "search hit TOP without match" when searching backward.  If
  4134. wrapscan is set and the search wraps around the end of the file the message
  4135. "search hit TOP, continuing at BOTTOM" or "search hit BOTTOM, continuing at
  4136. TOP" is given when searching backwards or forwards respectively.  This can be
  4137. switched off by setting the 's' flag in the 'shortmess' option.  The highlight
  4138. method 'w' is used for this message (default: standout).
  4139.  
  4140.                             *search_range*
  4141. You cannot limit the search command "/" to a certain range of lines.  A trick
  4142. to do this anyway is to use the ":substitute" command with the 'c' flag.
  4143. Example:
  4144.     :.,300s/Pattern//gc
  4145. This command will search from the cursor position until line 300 for
  4146. "Pattern".  At the match, you will be asked to type a character.  Type 'q' to
  4147. stop at this match, type 'n' to find the next match.
  4148.  
  4149. The "*", "#", "g*" and "g#" commands look for a word near the cursor in this
  4150. order, the first one that is found is used:
  4151. - The keyword currently under the cursor.
  4152. - The first keyword to the right of the cursor, in the same line.
  4153. - The WORD currently under the cursor.  
  4154. - The first WORD to the right of the cursor, in the same line.
  4155. The keyword may only contain letters and characters in 'iskeyword'.
  4156. The WORD may contain any non-blanks (<Tab>s and/or <Space>s).
  4157. Note that if you type with ten fingers, the characters are easy to remember:
  4158. the "#" is under your left hand middle finger (search to the left and up) and
  4159. the "*" is under your right hand middle finger (search to the right and down).
  4160.  
  4161.  
  4162. The definition of a pattern:                *search_pattern*
  4163.  
  4164. Patterns may contain special characters, depending on the setting of the
  4165. 'magic' option.
  4166.  
  4167.                             */bar* */\bar*
  4168. 1. A pattern is one or more branches, separated by "\|".  It matches anything
  4169.    that matches one of the branches.  Example: "foo\|beep" matches "foo" and
  4170.    "beep".
  4171.  
  4172. 2. A branch is one or more pieces, concatenated.  It matches a match for the
  4173.    first, followed by a match for the second, etc.  Example: "foo[0-9]beep",
  4174.    first match "foo", then a digit and then "beep".
  4175.  
  4176. 3. A piece is an atom, possibly followed by:
  4177.       magic   nomagic
  4178.                             */star* */\star*
  4179.     *    \*    matches 0 or more of the preceding atom
  4180.                             */\+*
  4181.     \+    \+    matches 1 or more of the preceding atom {not in Vi}
  4182.                             */\=*
  4183.     \=    \=    matches 0 or 1 of the preceding atom {not in Vi}
  4184.  
  4185.     Examples:
  4186.        .*    .\*    matches anything, also empty string
  4187.        ^.\+$    ^.\+$    matches any non-empty line
  4188.        foo\=    foo\=    matches "fo" and "foo"
  4189.  
  4190.  
  4191. 4. An atom can be:
  4192.    - One of these five:
  4193.       magic   nomagic
  4194.     ^    ^    at beginning of pattern, matches start of line    */^*
  4195.     $    $    at end of pattern or in front of "\|",        */$*
  4196.             matches end of line
  4197.     .    \.    matches any single character          */.* */\.*
  4198.     \<    \<    matches the beginning of a word            */\<*
  4199.     \>    \>    matches the end of a word            */\>*
  4200.     \i    \i    matches any identifier character (see        */\i*
  4201.             'isident' option) {not in Vi}
  4202.     \I    \I    like "\i", but excluding digits {not in Vi}    */\I*
  4203.     \k    \k    matches any keyword character (see        */\k*
  4204.             'iskeyword' option) {not in Vi}
  4205.     \K    \K    like "\k", but excluding digits {not in Vi}    */\K*
  4206.     \f    \f    matches any file name character (see        */\f*
  4207.             'isfname' option) {not in Vi}
  4208.     \F    \F    like "\f", but excluding digits {not in Vi}    */\F*
  4209.     \p    \p    matches any printable character (see        */\p*
  4210.             'isprint' option) {not in Vi}
  4211.     \P    \P    like "\p", but excluding digits {not in Vi}    */\P*
  4212.     \e    \e    <Esc>                        */\e*
  4213.     \t    \t    <Tab>                        */\t*
  4214.     \r    \r    <CR>                        */\r*
  4215.     \b    \b    <BS>                        */\b*
  4216.     ~    \~    matches the last given substitute string    */~* */\~*
  4217.     \(\)    \(\)    A pattern enclosed by escaped parentheses      */\(\)*
  4218.             (e.g., "\(^a\)") matches that pattern
  4219.     x    x    A single character, with no special meaning,
  4220.             matches itself
  4221.     \x    \x    A backslash followed by a single character,    */\*
  4222.             with no special meaning, matches the single
  4223.             character
  4224.     []    \[]    A range. This is a sequence of characters    */[]*
  4225.             enclosed in "[]" or "\[]".  It matches any    */\[]*
  4226.             single character from the sequence.  If the
  4227.             sequence begins with "^", it matches any
  4228.             single character NOT in the sequence.  If two
  4229.             characters in the sequence are separated by '-', this
  4230.             is shorthand for the full list of ASCII characters
  4231.             between them.  E.g., "[0-9]" matches any decimal
  4232.             digit.  To include a literal "]" in the sequence, make
  4233.             it the first character (following a possible "^").
  4234.             E.g., "[]xyz]" or "[^]xyz]".  To include a literal
  4235.             '-', make it the first or last character.
  4236.  
  4237. If the 'ignorecase' option is on, the case of letters is ignored.
  4238.  
  4239. It is impossible to have a pattern that contains a line break.
  4240.  
  4241. Examples:
  4242. ^beep(            Probably the start of the C function "beep".
  4243.  
  4244. [a-zA-Z]$        Any alphabetic character at the end of a line.
  4245.  
  4246. \<\I\i        or
  4247. \(^\|[^a-zA-Z0-9_]\)[a-zA-Z_]\+[a-zA-Z0-9_]*
  4248.             A C identifier (will stop in front of it).
  4249.  
  4250. \(\.$\|\. \)        A period followed by end-of-line or a space.
  4251.             Note that "\(\. \|\.$\)" does not do the same,
  4252.             because '$' is not end-of-line in front of '\)'.
  4253.             This was done to remain Vi-compatible.
  4254.  
  4255. [.!?][])"']*\($\|[ ]\)    A search pattern that finds the end of a sentence,
  4256.             with almost the same definition as the ")" command.
  4257.  
  4258. Technical detail:
  4259. <Nul> characters in the file are stored as <NL> in memory.  In the display
  4260. they are shown as "^@".  The translation is done when reading and writing
  4261. files.  To match a <Nul> with a search pattern you can just enter CTRL-@ or
  4262. "CTRL-V 000".  This is probably just what you expect.  Internally the
  4263. character is replaced with a <NL> in the search pattern.  What is unusual is
  4264. that typing CTRL-V CTRL-J also inserts a <NL>, thus also searches for a
  4265. <Nul> in the file.  {Vi cannot handle <Nul> characters in the file at all}
  4266.  
  4267.  
  4268. 6.7 Various motions                *various_motions*
  4269.  
  4270.                         *m*
  4271. m<a-zA-Z>        Set mark <a-zA-Z> at cursor position (does not move
  4272.             the cursor, this is not a motion command).
  4273.  
  4274.                         *:ma* *:mark*
  4275. :[range]ma[rk] <a-zA-Z>    Set mark <a-zA-Z> at last line number in [range],
  4276.             column 0.  Default is cursor line.
  4277.  
  4278.                         *:k*
  4279. :[range]k<a-zA-Z>    Same as :mark, but the space before the mark name can
  4280.             be omitted.
  4281.  
  4282.                         *'* *'a*
  4283. '<a-z>            To the first non-blank character on the line with
  4284.             mark <a-z> (linewise).
  4285.                         *'A* *'0*
  4286. '<A-Z0-9>        To the first non-blank character on the line with
  4287.             mark <A-Z0-9> in the correct file (linewise when in
  4288.             same file, not a motion command when in other file).
  4289.             {not in Vi}
  4290.  
  4291.                         *`* *`a*
  4292. `<a-z>            To the mark <a-z> (exclusive).
  4293.                         *`A* *`0*
  4294. `<A-Z0-9>        To the mark <A-Z0-9> in the correct file (exclusive
  4295.             when in same file, not a motion command when in
  4296.             other file).  {not in Vi}
  4297.  
  4298.                         *:marks*
  4299. :marks            List all the current marks (not a motion command).
  4300.             {not in Vi}
  4301.  
  4302. :marks {arg}        List the marks that are mentioned in {arg} (not a
  4303.             motion command).  For example:
  4304.                 :marks aB
  4305.             to list marks 'a' and 'B'.  {not in Vi}
  4306.  
  4307. A mark is not visible in any way.  It is just a position in the file that is
  4308. remembered.  Do not confuse marks with named registers, they are totally
  4309. unrelated.
  4310.  
  4311. 'a - 'z        lowercase marks, valid within one file
  4312. 'A - 'Z        uppercase marks, also called file marks, valid between files
  4313. '0 - '9        numbered marks, set from .viminfo file
  4314.  
  4315. Lowercase marks 'a to 'z are remembered as long as the file remains in the
  4316. buffer list.  If you remove the file from the buffer list, change a character
  4317. in a line or delete a line that contains a mark, that mark is erased.
  4318. Lowercase marks can be used in combination with operators.  For example: "d't"
  4319. deletes the lines from the cursor position to mark 't'.  Hint: Use mark 't' for
  4320. Top, 'b' for Bottom, etc..  Lowercase marks are restored when using undo and
  4321. redo.
  4322.  
  4323. Uppercase marks 'A to 'Z include the file name.  {Vi: no uppercase marks} You
  4324. can use them to jump from file to file.  You can only use an uppercase mark
  4325. with an operator if the mark is in the current file.  The line number of the
  4326. mark remains correct, even if you insert/delete lines or edit another file for
  4327. a moment.  When the 'viminfo' option is not empty, uppercase marks are kept in
  4328. the .viminfo file.  See |viminfo_file_marks|.
  4329.  
  4330. Numbered marks '0 to '9 are quite different.  They can not be set directly.
  4331. They are only present when using a viminfo file |viminfo_file|.  Basically '0
  4332. is the location of the cursor when you last exited Vim, '1 the last but one
  4333. time, etc.  See |viminfo_file_marks|.
  4334.  
  4335.                             *'[*
  4336. '[            To the first non-blank character on the first line
  4337.             of the previously operated, inserted or putted text.
  4338.             {not in Vi}
  4339.  
  4340.                             *`[*
  4341. `[            To the first character of the previously operated,
  4342.             inserted or putted text.  {not in Vi}
  4343.  
  4344.                             *']*
  4345. ']            To the first non-blank character on the last line of
  4346.             the previously operated, inserted  or putted text.
  4347.             {not in Vi}
  4348.  
  4349.                             *`]*
  4350. `]            To the last character of the previously operated,
  4351.             inserted or putted text. {not in Vi}
  4352.  
  4353. After executing an operator the Cursor is put at the beginning of the text
  4354. that was operated upon.  After a put command ("p" or "P") the cursor is
  4355. sometimes placed at the first inserted line and sometimes on the last inserted
  4356. character.  The four commands above put the cursor at either end.  Example:
  4357. After yanking 10 lines you want to go to the last one of them: "10Y']".  After
  4358. inserting several lines with the "p" command you want to jump to the lowest
  4359. inserted line: "p']".  This also works for text that has been inserted.
  4360.  
  4361. Note: After deleting text, the start and end positions are the same, except
  4362. when using blockwise Visual mode.  These commands do not work when no
  4363. operator or put command has been used yet in the current file.
  4364.  
  4365.                             *'<*
  4366. '<            To the first non-blank character on the first line
  4367.             of the last selected Visual area.  {not in Vi}.
  4368.  
  4369.                             *`<*
  4370. `<            To the first character of the last selected Visual
  4371.             area.  {not in Vi}.
  4372.  
  4373.                             *'>*
  4374. '>            To the first non-blank character on the last line
  4375.             of the last selected Visual area.  {not in Vi}.
  4376.  
  4377.                             *`>*
  4378. `>            To the last character of the last selected Visual
  4379.             area.  {not in Vi}.
  4380.  
  4381.                             *''*
  4382. ''            To the first non-blank character of the line where
  4383.             the cursor was before the latest jump (linewise).
  4384.  
  4385.                             *``*
  4386. ``            To the position before latest jump (exclusive).
  4387.  
  4388.                             *'"*
  4389. '"            To the first non-blank character of the line where
  4390.             the cursor was the last time the current buffer was
  4391.             exited (linewise).  {not in Vi}.
  4392.  
  4393.                             *`"*
  4394. `"            To the cursor position when last exiting the current
  4395.             buffer (exclusive).  {not in Vi}.
  4396.  
  4397. A "jump" is one of the following commands: "'", "`", "G", "/", "?", "n",
  4398. "N", "%", "(", ")", "[[", "]]", "{", "}", ":s", ":tag", "L", "M", "H" and
  4399. the commands that start editing a new file.  If you make the cursor "jump"
  4400. with one of these commands, the position of the cursor before the jump is
  4401. remembered.  You can return to that position with the "''" and "``" command,
  4402. unless the line containing that position was changed or deleted.
  4403.  
  4404.                             *CTRL-O*
  4405. CTRL-O            Go to [count] Older cursor position in jump list
  4406.             (not a motion command).  {not in Vi}
  4407.  
  4408. <Tab>        or                    *CTRL-I* *<Tab>*
  4409. CTRL-I            Go to [count] newer cursor position in jump list
  4410.             (not a motion command).  {not in Vi}
  4411.  
  4412.                             *:ju* *:jumps*
  4413. :ju[mps]        Print the jump list (not a motion command).  {not in
  4414.             Vi}
  4415.  
  4416.                             *jumplist*
  4417. Jumps are remembered in a jump list.  With the CTRL-O and CTRL-I command you
  4418. can go to cursor positions before older jumps, and back again.  Thus you can
  4419. move up and down the list.
  4420.  
  4421. For example, after three jump commands you have this jump list:
  4422.  
  4423.  jump line  file
  4424.    1     1  -current-
  4425.    2    70  -current-
  4426.    3  1154  -current-
  4427. >
  4428.  
  4429. You are currently in line 1167.  If you then use the CTRL-O command, the
  4430. cursor is put in line 1154.  This results in:
  4431.  
  4432.  jump line  file
  4433.    1     1  -current-
  4434.    2    70  -current-
  4435. >  3  1154  -current-
  4436.    4  1167  -current-
  4437.  
  4438. The pointer will be set at the last used jump position.  The next CTRL-O
  4439. command will use the entry above it, the next CTRL-I command will use the
  4440. entry below it.  If the pointer is below the last entry, this indicates that
  4441. you did not use a CTRL-I or CTRL-O before.  In this case the CTRL-O command
  4442. will cause the cursor position to be added to the jump list, so you can get
  4443. back to the position before the CTRL-O.  In this case this is line 1167.
  4444.  
  4445. With more CTRL-O commands you will go to lines 70 and 1.  If you use CTRL-I
  4446. you can go back to 1154 and 1167 again.
  4447.  
  4448. If you use a jump command, the current line number is inserted at the end of
  4449. the jump list.  If the same line was already in the jump list, it is removed.
  4450. The result is that when repeating CTRL-O you will get back to old positions
  4451. only once.
  4452.  
  4453. After the CTRL-O command that got you into line 1154 you could give another
  4454. jump command (e.g., "G").  The jump list would then become:
  4455.  
  4456.  jump line  file
  4457.    1     1  -current-
  4458.    2    70  -current-
  4459.    3  1167  -current-
  4460.    4  1154  -current-
  4461. >
  4462.  
  4463. The line numbers will be adjusted for deleted and inserted lines.  This fails
  4464. if you stop editing a file without writing, like with ":n!".
  4465.  
  4466.                             *%*
  4467. %            Find the next item in this line after or under the
  4468.             cursor and jump to its match (inclusive).  Items can
  4469.             be:
  4470.             ([{}])        parenthesis or (curly/square) brackets
  4471.             /* */        start or end of C-style comment
  4472.             #if, #ifdef, #else, #elif, #endif
  4473.                     C preprocessor conditionals
  4474.             Parens and braces preceded with a backslash are
  4475.             ignored.  When the '%' character is not present in
  4476.             'cpoptions', parens and braces inside quotes are
  4477.             ignored, unless the number of parens/braces in a line
  4478.             is uneven and this line and the previous one does not
  4479.             end in a backslash.  No count is allowed ({count}%
  4480.             jumps to a line {count} percentage down the file).
  4481.             Using '%' on #if/#else/#endif makes the movement
  4482.             linewise.
  4483.  
  4484.                         *[(*
  4485. [(            go to [count] previous unmatched '('.  {not in Vi}
  4486.  
  4487.                         *[{*
  4488. [{            go to [count] previous unmatched '{'.  {not in Vi}
  4489.  
  4490.                         *])*
  4491. ])            go to [count] next unmatched ')'.  {not in Vi}
  4492.  
  4493.                         *]}*
  4494. ]}            go to [count] next unmatched '}'.  {not in Vi}
  4495.  
  4496. The above four commands can be used to go to the start or end of the current
  4497. code block.  It is like doing "%" on the '(', ')', '{' or '}' at the other
  4498. end of the code block, but you can do this from anywhere in the code block.
  4499. Very useful for C programs.  Example: When standing on "case x:", "[{" will
  4500. bring you back to the switch statement.
  4501.  
  4502.                         *[#*
  4503. [#            go to [count] previous unmatched "#if" or "#else".
  4504.             {not in Vi}
  4505.  
  4506.                         *]#*
  4507. ]#            go to [count] next unmatched "#else" or "#endif".  {not
  4508.             in Vi}
  4509.  
  4510. These two commands work in C programs that contain #if/#else/#endif
  4511. constructs.  It brings you to the start or end of the #if/#else/#endif where
  4512. the current line is included.  You can then use "%" to go to the matching line.
  4513.  
  4514.                         *[star* *[/*
  4515. [*  or  [/        go to [count] previous start of a C comment "/*".  {not
  4516.             in Vi}
  4517.  
  4518.                         *]star* *]/*
  4519. ]*  or  ]/        go to [count] next end of a C comment "*/".  {not
  4520.             in Vi}
  4521.  
  4522.  
  4523.                         *H*
  4524. H            To line [count] from top (Home) of screen (default:
  4525.             first line on the screen) on the first non-blank
  4526.             character (linewise).  See also 'startofline' option.
  4527.             Cursor is adjusted for 'scrolloff' option.
  4528.  
  4529.                         *M*
  4530. M            To Middle line of screen, on the first non-blank
  4531.             character (linewise).  See also 'startofline' option.
  4532.  
  4533.                         *L*
  4534. L            To line [count] from bottom of screen (default: Last
  4535.             line on the screen) on the first non-blank character
  4536.             (linewise).  See also 'startofline' option.
  4537.             Cursor is adjusted for 'scrolloff' option.
  4538.  
  4539. <LeftMouse>        Moves to the position on the screen where the mouse
  4540.             click is (inclusive).  See also |<LeftMouse>|.  If the
  4541.             position is in a status line, that window is made the
  4542.             active window and the cursor is not moved.  {not in Vi}
  4543.  
  4544.  
  4545. 7. Scrolling                        *scrolling*
  4546. ============
  4547.  
  4548. Move edit window (the part of the buffer that you see) downwards (this means
  4549. that more lines downwards in the text buffer are seen):
  4550.  
  4551.                             *CTRL-E*
  4552. CTRL-E            Scroll window [count] lines downwards in the buffer.
  4553.             Mnemonic: Extra lines.
  4554.  
  4555.                             *CTRL-D*
  4556. CTRL-D            Scroll window Downwards in the buffer.  The number of
  4557.             lines comes from the 'scroll' option (default: half a
  4558.             screen).  If [count] given, first set 'scroll' option
  4559.             to [count].  The cursor is moved the same number of
  4560.             lines down in the file (if possible; when lines wrap
  4561.             and when hitting the end of the file there may be a
  4562.             difference).  When the cursor is on the last line of
  4563.             the buffer nothing happens and a beep is produced.
  4564.             See also 'startofline' option.
  4565.             {difference from vi: Vim scrolls 'scroll' screen
  4566.             lines, instead of file lines; makes a difference when
  4567.             lines wrap}
  4568.  
  4569. <S-Down>    or                    *<S-Down>*
  4570. <PageDown>    or                    *<PageDown>* *CTRL-F*
  4571. CTRL-F            Scroll window [count] pages Forwards (downwards) in
  4572.             the buffer.  See also 'startofline' option.
  4573.  
  4574. Move edit window (the part of the buffer that you see) upwards (this means
  4575. that more lines upwards in the text buffer are seen):
  4576.  
  4577.                             *CTRL-Y*
  4578. CTRL-Y            Scroll window [count] lines upwards in the buffer.
  4579.  
  4580.                             *CTRL-U*
  4581. CTRL-U            Scroll window Upwards in the buffer.  The number of
  4582.             lines comes from the 'scroll' option (default: half a
  4583.             screen).  If [count] given, first set the 'scroll'
  4584.             option to [count].  The cursor is moved the same
  4585.             number of lines up in the file (if possible; when
  4586.             lines wrap and when hitting the end of the file there
  4587.             may be a difference).  When the cursor is on the first
  4588.             line of the buffer nothing happens and a beep is
  4589.             produced.  See also 'startofline' option.
  4590.             {difference from vi: Vim scrolls 'scroll' screen
  4591.             lines, instead of file lines; makes a difference when
  4592.             lines wrap}
  4593.  
  4594. <S-Up>        or                    *<S-Up>*
  4595. <PageUp>    or                    *<PageUp>* *CTRL-B*
  4596. CTRL-B            Scroll window [count] pages Backwards (upwards) in the
  4597.             buffer.  See also 'startofline' option.
  4598.  
  4599. Window repositioning:
  4600.  
  4601.                             *z* *z<CR>*
  4602. z<CR>            Redraw, line [count] at top of window (default
  4603.             cursor line).  Put cursor at first non-blank in the
  4604.             line.
  4605.  
  4606.                             *zt*
  4607. zt            Like "z<CR>", but leave the cursor in the same
  4608.             column.  {not in Vi}
  4609.  
  4610.                             *zN<CR>*
  4611. z{height}<CR>        Redraw, make window {height} lines tall.  This is
  4612.             useful to make the number of lines small when screen
  4613.             updating is very slow.  Cannot make the height more
  4614.             than the physical screen height.
  4615.  
  4616.                             *z.*
  4617. z.            Redraw, line [count] at center of window (default
  4618.             cursor line).  Put cursor at first non-blank in the
  4619.             line.
  4620.  
  4621.                             *zz*
  4622. zz            Like "z.", but leave the cursor in the same column.
  4623.             Careful: If caps-lock is on, this commands becomes
  4624.             "ZZ": write buffer and exit!  {not in Vi}
  4625.  
  4626.                             *z-*
  4627. z-            Redraw, line [count] at bottom of window (default
  4628.             cursor line).  Put cursor at first non-blank in the
  4629.             line.
  4630.  
  4631.                             *zb*
  4632. zb            Like "z-", but leave the cursor in the same column.
  4633.             {not in Vi}
  4634.  
  4635. These commands move the contents of the window.  If the cursor position is
  4636. moved off of the window, the cursor is moved onto the window (with
  4637. 'scrolloff' screen lines around it).  A page is the number of lines in the
  4638. window minus two.  The mnemonics for these commands may be a bit confusing.
  4639. Remember that the commands refer to moving the window upwards or downwards
  4640. in the buffer.  When the window moves upwards in the buffer, the text in the
  4641. window moves downwards on your screen.
  4642.  
  4643. z<Right>    or                        *zl* *z<Right>*
  4644. zl            Scroll the screen [count] characters to the left.
  4645.             This only works when 'wrap' is off.  {not in Vi}
  4646.  
  4647. z<Left>      or                        *zh* *z<Left>*
  4648. zh            Scroll the screen [count] characters to the right.
  4649.             This only works when 'wrap' is off.  {not in Vi}
  4650.  
  4651. For these two commands the cursor follows the screen.  If the character that
  4652. the cursor is on is moved off the screen, the cursor is moved to the closest
  4653. character that is on the screen.  The value of 'sidescroll' is not used.
  4654.  
  4655.                             *zs*
  4656. zs            Scroll the screen horizontally to position the cursor
  4657.             at the start (left side) of the screen.  This only
  4658.             works when 'wrap' is off.  {not in Vi}
  4659.  
  4660.                             *ze*
  4661. ze            Scroll the screen horizontally to position the cursor
  4662.             at the end (right side) of the screen.  This only
  4663.             works when 'wrap' is off.  {not in Vi}
  4664.  
  4665. For these two commands the cursor is not moved in the text, only the text
  4666. scrolls on the screen.
  4667.  
  4668.  
  4669. 8. Tags and special searches                *tags_and_searches*
  4670. ============================
  4671.  
  4672. 8.1 Tags                        *tag_commands*
  4673.  
  4674.                             *:ta* *:tag*
  4675. :ta[g][!] {ident}    Jump to the definition of {ident}, using the
  4676.             information in the tags file.  Put {ident} in the tag
  4677.             stack.  See below for [!].
  4678.  
  4679. g<LeftMouse>                        *g<LeftMouse>*
  4680. <C-LeftMouse>                    *<C-LeftMouse>* *CTRL-]*
  4681. CTRL-]            ":ta" to the keyword under or after cursor.  Put the
  4682.             keyword in the tag stack.  {Vi: identifier after the
  4683.             cursor}
  4684.  
  4685.                             *v_CTRL-]*
  4686. {Visual}CTRL-]        ":ta" to the text that is highlighted.  {not in Vi}
  4687.  
  4688. g<RightMouse>                        *g<RightMouse>*
  4689. <C-RightMouse>                    *<C-RightMouse>* *CTRL-T*
  4690. CTRL-T            Jump to [count] older entry in the tag stack
  4691.             (default 1).  {not in Vi}
  4692.  
  4693.                             *:po* *:pop*
  4694. :[count]po[p][!]    Jump to [count] older entry in tag stack (default 1).
  4695.             See below for [!].  {not in Vi}
  4696.  
  4697. :[count]ta[g][!]    Jump to [count] newer entry in tag stack (default 1).
  4698.             See below for [!].  {not in Vi}
  4699.  
  4700.                             *:tags*
  4701. :tags            Show the contents of the tag stack.  The active
  4702.             entry is marked with a '>'.  {not in Vi}
  4703.  
  4704. A tag is an identifier that appears in the "tags" file.  It is a sort of label
  4705. that can be jumped to.  For example: In C programs each function name can be
  4706. used as a tag.
  4707.  
  4708. With the ":tag" command the cursor will be positioned on the tag.  With the
  4709. CTRL-] command, the keyword on which the cursor is standing is used as the
  4710. tag.  If the cursor is not on a keyword, the first keyword to the right of the
  4711. cursor is used.
  4712.  
  4713.                             *tag_priority*
  4714. When there are multiple matches for a tag, this priority is used:
  4715. 1.  The first matching static tag with a full matching tag for the current
  4716.     file.
  4717. 2.  The first matching global tag with a full matching tag.
  4718. 3.  The first matching static tag with a full matching tag for another file.
  4719. 4.  The first matching static tag with an ignore-case matching tag for the
  4720.     current file.
  4721. 5.  The first matching global tag with an ignore-case matching tag.
  4722. 6.  The first matching static tag with an ignore-case matching tag for another
  4723.     file.
  4724.  
  4725.                             *static_tag*
  4726. A static tag is a tag that is defined for a specific file.  In a C program this
  4727. could be a static function.
  4728.  
  4729. In Vi jumping to a tag sets the current search pattern.  This means that
  4730. the "n" command after jumping to a tag does not search for the same pattern
  4731. that it did before jumping to the tag.  Vim does not do this as we consider it
  4732. to be a bug.  You can still find the tag search pattern in the search history.
  4733. If you really want the old Vi behaviour, set the 't' flag in 'cpoptions'.
  4734.  
  4735. If the tag is in the current file this will always work.  Otherwise the
  4736. performed actions depend on whether the current file was changed, whether a !
  4737. is added to the command and on the 'autowrite' option:
  4738.  
  4739.   tag in       file       autowrite
  4740. current file  changed    !   option      action
  4741. -----------------------------------------------------------------------------
  4742.     yes         x    x     x      goto tag
  4743.     no         no    x     x      read other file, goto tag
  4744.     no        yes    yes    x   abandon current file, read other file, goto
  4745.                   tag
  4746.     no        yes    no    on  write current file, read other file, goto
  4747.                   tag
  4748.     no        yes    no   off  fail
  4749. -----------------------------------------------------------------------------
  4750.  
  4751. - If the tag is in the current file, the command will always work.
  4752. - If the tag is in another file and the current file was not changed, the
  4753.   other file will be made the current file and read into the buffer.
  4754. - If the tag is in another file, the current file was changed and a ! is
  4755.   added to the command, the changes to the current file are lost, the other
  4756.   file will be made the current file and read into the buffer.
  4757. - If the tag is in another file, the current file was changed and the
  4758.   'autowrite' option is on, the current file will be written, the other
  4759.   file will be made the current file and read into the buffer.
  4760. - If the tag is in another file, the current file was changed and the
  4761.   'autowrite' option is off, the command will fail.  If you want to save
  4762.   the changes, use the ":w" command and then use ":tag" without an argument.
  4763.   This works because the tag is put on the stack anyway.  If you want to lose
  4764.   the changes you can use the ":tag!" command.
  4765.  
  4766. The ":tag" command works very well for C programs.  If you see a call to a
  4767. function and wonder what that function does, position the cursor inside of
  4768. the function name and hit CTRL-].  This will bring you to the function
  4769. definition.  An easy way back is with the CTRL-T command.  Also read about the
  4770. tag stack below.
  4771.  
  4772. A tags file can be created with the external command 'ctags'.  It will
  4773. contain a tag for each function.  Some versions of 'ctags' will also make a
  4774. tag for each "#defined" macro.
  4775.  
  4776. The lines in the tags file should have this format:
  4777.  
  4778.     {tag}{separator}{filename}{separator}{command}
  4779.  
  4780. {tag}        the identifier
  4781. {separator}    one or more <Tab> or space characters
  4782. {filename}    the file that contains the definition of {tag}
  4783. {command}    the Ex command that positions the cursor on the tag.
  4784.  
  4785. The identifier normally is the name of a function, but it can be any
  4786. identifier.  There is one special form for local (static) functions:
  4787. {filename}:{identifier}.  Some ctags programs make use of this to separate
  4788. local (static) functions from global functions.
  4789. (Detail: Vim compares only the last part of the filename and ignores any
  4790. path before it).
  4791.  
  4792.                             *tag_search*
  4793. The command can be any Ex command, but normally it is a search command like
  4794.     "/^main(argc, argv)"
  4795. If it is a search command, and the search fails, another try is done ignoring
  4796. case.  If that fails too, a search is done for:
  4797.     "^main[ \t]*("
  4798. (the tag with '^' prepended and "[ \t]*(" appended).  When using function
  4799. names, this will find the function name when it is in column 0.  This will
  4800. help when the arguments to the function have changed since the tags file was
  4801. made.  If this search also fails another search is done with:
  4802.     "^[#a-zA-Z_].*main[ \t]*("
  4803. This means: A line starting with '#' or an identifier and containing the tag
  4804. followed by white space and a '('.  This will find macro names and function
  4805. names with a type prepended.  {the extra searches are not in Vi}.
  4806.  
  4807. Note that Vim forbids some commands, for security reasons.  This works like
  4808. using the 'secure' option for exrc/vimrc files in the current directory.  See
  4809. |trojan_horse|. {this security prevention is not present in Vi}.
  4810.  
  4811. In Vi the ":tag" command sets the last search pattern when the tag is searched
  4812. for.  In Vim this is not done, the previous search pattern is still remembered,
  4813. unless the 't' flag is present in 'cpoptions'.  The search pattern is always
  4814. put in the search history.
  4815.  
  4816.                             *emacs_tags*
  4817. Emacs style tag files are supported if Vim was compiled with EMACS_TAGS
  4818. defined.  Check the output of ":version", if it contains "+emacs_tags" then it
  4819. was.  Sorry, there is no explanation about Emacs tag files here, it is only
  4820. supported for backwards compatibility :-).
  4821.  
  4822.                             *tags_option*
  4823. The 'tags' option is a list of file names.  Each of these files is searched
  4824. for the tag.  This can be used to use a different tags file than the default
  4825. file "tags".  It can also be used to access a common tags file.
  4826.  
  4827. The next file in the list is not used when:
  4828. - A matching static tag for the current buffer has been found.
  4829. - A matching global tag has been found.
  4830. This also depends on the 'ignorecase' option.  If it is off, and the tags file
  4831. only has a match without matching case, the next tags file is searched for a
  4832. match with matching case.  If no tag with matching case is found, the first
  4833. match without matching case is used.  If 'ignorecase' is on, and a matching
  4834. global tag with or without matching case is found, this one is used, no
  4835. further tags files are searched.
  4836.  
  4837. When a tag file name starts with "./", the '.' is replaced with the path of
  4838. the current file.  This makes it possible to use a tags file in the directory
  4839. where the current file is (no matter what the current directory is).  The idea
  4840. of using "./" is that you can define which tag file is searched first: In the
  4841. current directory ("tags,./tags") or in the directory of the current file
  4842. ("./tags,tags").
  4843.  
  4844. For example:
  4845.  
  4846.     :set tags=./tags,tags,/home/user/commontags
  4847.  
  4848. In this example the tag will first be searched for in the file "tags" in the
  4849. directory where the current file is.  Next the "tags" file in the current
  4850. directory.  If it is not found there, then the file "/home/user/commontags"
  4851. will be searched for the tag.
  4852.  
  4853. Instead of the comma a space may be used.  Then a backslash is required for
  4854. the space to be included in the string option:
  4855.  
  4856.     :set tags=tags\ /home/user/commontags
  4857.  
  4858. To include a space in a file name use three backslashes.  To include a comma in
  4859. a file name use two backslashes.  For example, use:
  4860.  
  4861.     :set tags=tag\\\ file,/home/user/common\\,tags
  4862.  
  4863. for the files "tag file" and "/home/user/common,tags".  The 'tags' option will
  4864. have the value "tag\ file,/home/user/common\,tags".
  4865.  
  4866. If the 'tagrelative' option is on (which is the default) and using a tag file
  4867. in another directory, file names in that tag file are relative to the
  4868. directory where the tag file is.
  4869.  
  4870.  
  4871.                             *tagstack*
  4872. The tags that you use are remembered in the tag stack.  You can print this
  4873. stack with the ":tags" command.  The result looks like this:
  4874.  
  4875.   # TO tag    FROM line in file
  4876.   1 main           1  harddisk2:text/vim/test
  4877. > 2 FuncA          58  -current-
  4878.   3 FuncC         357  harddisk2:text/vim/src/amiga.c
  4879.  
  4880. This list shows the tags that you jumped to and the cursor position before that
  4881. jump.  The older tags are at the top, the newer at the bottom.
  4882.  
  4883. The '>' points to the active entry.  This is the tag that will be used by the
  4884. next ":tag" command.  The CTRL-T and ":pop" command will use the position
  4885. above the active entry.
  4886.  
  4887. The line number and file name are remembered to be able to get back to where
  4888. you were before the tag command.  The line number will be correct, also when
  4889. deleting/inserting lines, unless this was done by another program (e.g.
  4890. another instance of Vim).
  4891.  
  4892. You can jump to previously used tags with several commands.  Some examples:
  4893.  
  4894.     ":pop" or CTRL-T    to position before previous tag
  4895.     {count}CTRL-T        to position before {count} older tag
  4896.     ":tag"            to newer tag
  4897.     ":0tag"            to last used tag
  4898.  
  4899. The most obvious way to use this is while browsing through the call graph of
  4900. a program.  Consider the following call graph:
  4901.  
  4902.     main  --->  FuncA  --->  FuncC
  4903.           --->  FuncB
  4904.  
  4905. (Explanation: main calls FuncA and FuncB; FuncA calls FuncC).
  4906. You can get from main to FuncA by using CTRL-] on the call to FuncA.  Then
  4907. you can CTRL-] to get to FuncC.  If you now want to go back to main you can
  4908. use CTRL-T twice.  Then you can CTRL-] to FuncB.
  4909.  
  4910. If you issue a ":ta {ident}" or CTRL-] command, this tag is inserted at the
  4911. current position in the stack.  If the stack was full (it can hold up to 20
  4912. entries), the oldest entry is deleted and the older entries shift one
  4913. position up (their index number is decremented by one).  If the last used
  4914. entry was not at the bottom, the entries below the last used one are
  4915. deleted.  This means that an old branch in the call graph is lost.  After the
  4916. commands explained above the tag stack will look like this:
  4917.  
  4918.   # TO tag    FROM line in file
  4919.   1 main           1  harddisk2:text/vim/test
  4920.   2 FuncB          59  harddisk2:text/vim/src/main.c
  4921. >
  4922.  
  4923.  
  4924. 8.2 Include file searches                *include_search*
  4925.  
  4926. These commands look for a string in the current file and in all encountered
  4927. included files (recursively).  This can be used to find the definition of a
  4928. variable, function or macro.  If you only want to search in the current
  4929. buffer, use the commands listed at |pattern_searches|.
  4930.  
  4931. When a line is encountered that includes another file, that file is searched
  4932. before continuing in the current buffer.  Files included by included files are
  4933. also searched.  When an include file could not be found it is silently
  4934. ignored.  Use the ":checkpath" command to discover which files could not be
  4935. found, possibly your 'path' option is not set up correctly.  Note: the
  4936. included file is searched, not a buffer that may be editing that file.  Only
  4937. for the current file the lines in the buffer are used.
  4938.  
  4939. The string can be any keyword or a defined macro.  For the keyword any match
  4940. will be found.  For defined macros only lines that match with the 'define'
  4941. option will be found.  The default is "\^#[ \t]*define", which is for C
  4942. programs.  Also, when a match is found for a defined macro, the displaying of
  4943. lines continues with the next line when a line ends in a backslash.
  4944.  
  4945. The commands that start with "[" start searching from the start of the current
  4946. file.  The commands that start with "]" start at the current cursor position.
  4947.  
  4948. The 'include' option is used to define a line that includes another file.  The
  4949. default is "\^#[ \t]*include", which is for C programs.  Note: Vim does not
  4950. recognize C syntax, if the 'include' option matches a line inside
  4951. "#ifdef/#endif" or inside a comment, it is searched anyway.  The 'isfname'
  4952. option is used to recognize the file name that comes after the matched
  4953. pattern.
  4954.  
  4955. The 'path' option is used to find the directory for the include files that
  4956. do not have an absolute path.
  4957.  
  4958. The 'comments' option is used for the commands that display a single line or
  4959. jump to a line.  It defines patterns that may start a comment.  Those lines
  4960. are ignored for the search, unless [!] is used.  One exception: When the line
  4961. matches the pattern "^# *define" it is not considered to be a comment.
  4962.  
  4963.                             *[i*
  4964. [i            Display the first line that contains the keyword
  4965.             under the cursor.  The search starts at the beginning
  4966.             of the file.  Lines that look like a comment are
  4967.             ignored (see 'comments' option).  If a count is given,
  4968.             the count'th matching line is displayed.  {not in Vi}
  4969.  
  4970.                             *]i*
  4971. ]i            like "[i", but start at the current cursor position.
  4972.             {not in Vi}
  4973.  
  4974.                             *:is* *:isearch*
  4975. :[range]is[earch][!] [count] [/]pattern[/]
  4976.             Like "[i"  and "]i", but search in [range] lines
  4977.             (default: whole file).  Without [!] lines that are
  4978.             recognized as comments are skipped.  Without [/] only
  4979.             whole words are matched, using the pattern
  4980.             "\<pattern\>".  {not in Vi}
  4981.  
  4982.                             *[I*
  4983. [I            Display all lines that contain the keyword under the
  4984.             cursor.  File names and line numbers are displayed
  4985.             for the found lines.  The search starts at the
  4986.             beginning of the file.  {not in Vi}
  4987.  
  4988.                             *]I*
  4989. ]I            like "[I", but start at the current cursor position.
  4990.             {not in Vi}
  4991.  
  4992.                             *:il* *:ilist*
  4993. :[range]il[ist][!] [/]pattern[/]
  4994.             Like "[I" and "]I", but search in [range] lines
  4995.             (default: whole file).  Without [!] lines that are
  4996.             recognized as comments are skipped.  Without [/] only
  4997.             whole words are matched, using the pattern
  4998.             "\<pattern\>".  {not in Vi}
  4999.  
  5000.                             *[_CTRL-I*
  5001. [ CTRL-I        Jump to the first line that contains the keyword
  5002.             under the cursor.  The search starts at the beginning
  5003.             of the file.  Lines that look like a comment are
  5004.             ignored (see 'comments' option).  If a count is given,
  5005.             the count'th matching line is jumped to.  {not in Vi}
  5006.  
  5007.                             *]_CTRL-I*
  5008. ] CTRL-I        like "[ CTRL-I", but start at the current cursor
  5009.             position.  {not in Vi}
  5010.  
  5011.                             *:ij* *:ijump*
  5012. :[range]ij[ump][!] [count] [/]pattern[/]
  5013.             Like "[ CTRL-I"  and "] CTRL-I", but search in
  5014.             [range] lines (default: whole file).  Without [!]
  5015.             lines that are recognized as comments are skipped.
  5016.             Without [/] only whole words are matched, using the
  5017.             pattern "\<pattern\>".  {not in Vi}
  5018.  
  5019. CTRL-W CTRL-I                    *CTRL-W_CTRL-I* *CTRL-W_i*
  5020. CTRL-W i        Open a new window, with the cursor on the first line
  5021.             that contains the keyword under the cursor.  The
  5022.             search starts at the beginning of the file.  Lines
  5023.             that look like a comment line are ignored (see
  5024.             'comments' option).  If a count is given, the count'th
  5025.             matching line is jumped to.  {not in Vi}
  5026.  
  5027.                             *:isp* *:isplit*
  5028. :[range]isp[lit][!] [count] [/]pattern[/]
  5029.             Like "CTRL-W i"  and "CTRL-W i", but search in
  5030.             [range] lines (default: whole file).  Without [!]
  5031.             lines that are recognized as comments are skipped.
  5032.             Without [/] only whole words are matched, using the
  5033.             pattern "\<pattern\>".  {not in Vi}
  5034.  
  5035.                             *[d*
  5036. [d            Display the first macro definition that contains the
  5037.             macro under the cursor.  The search starts from the
  5038.             beginning of the file.  If a count is given, the
  5039.             count'th matching line is displayed.  {not in Vi}
  5040.  
  5041.                             *]d*
  5042. ]d            like "[d", but start at the current cursor position.
  5043.             {not in Vi}
  5044.  
  5045.                             *:ds* *:dsearch*
  5046. :[range]ds[earch][!] [count] [/]pattern[/]
  5047.             Like "[d"  and "]d", but search in [range] lines
  5048.             (default: whole file).  Without [!] lines that are
  5049.             recognized as comments are skipped.  Without [/] only
  5050.             whole words are matched, using the pattern
  5051.             "\<pattern\>".  {not in Vi}
  5052.  
  5053.                             *[D*
  5054. [D            Display all macro definitions that contain the macro
  5055.             under the cursor.  File names and line numbers are
  5056.             displayed for the found lines.  The search starts
  5057.             from the beginning of the file.  {not in Vi}
  5058.  
  5059.                             *]D*
  5060. ]D            like "[D", but start at the current cursor position.
  5061.             {not in Vi}
  5062.  
  5063.                             *:dl* *:dlist*
  5064. :[range]dl[ist][!] [/]pattern[/]
  5065.             Like "[D"  and "]D", but search in [range] lines
  5066.             (default: whole file).  Without [!] lines that are
  5067.             recognized as comments are skipped.  Without [/] only
  5068.             whole words are matched, using the pattern
  5069.             "\<pattern\>".  {not in Vi}
  5070.  
  5071.                             *[_CTRL-D*
  5072. [ CTRL-D        Jump to the first macro definition that contains the
  5073.             keyword under the cursor.  The search starts from
  5074.             the beginning of the file.  If a count is given, the
  5075.             count'th matching line is jumped to.  {not in Vi}
  5076.  
  5077.                             *]_CTRL-D*
  5078. ] CTRL-D        like "[ CTRL-D", but start at the current cursor
  5079.             position.  {not in Vi}
  5080.  
  5081.                             *:dj* *:djump*
  5082. :[range]dj[ump][!] [count] [/]pattern[/]
  5083.             Like "[ CTRL-D"  and "] CTRL-D", but search  in
  5084.             [range] lines (default: whole file).  Without [!]
  5085.             lines that are recognized as comments are skipped.
  5086.             Without [/] only whole words are matched, using the
  5087.             pattern "\<pattern\>".  {not in Vi}
  5088.  
  5089. CTRL-W CTRL-D                    *CTRL-W_CTRL-D* *CTRL-W_d*
  5090. CTRL-W d        Open a new window, with the cursor on the first
  5091.             macro definition line that contains the keyword
  5092.             under the cursor.  The search starts from the
  5093.             beginning of the file.  If a count is given, the
  5094.             count'th matching line is jumped to.  {not in Vi}
  5095.  
  5096.                             *:dsp* *:dsplit*
  5097. :[range]dsp[lit][!] [count] [/]pattern[/]
  5098.             Like "CTRL-W d", but search in [range] lines
  5099.             (default: whole file).  Without [!] lines that are
  5100.             recognized as comments are skipped.  Without [/] only
  5101.             whole words are matched, using the pattern
  5102.             "\<pattern\>".  {not in Vi}
  5103.  
  5104.                             *:che* *:checkpath*
  5105. :che[ckpath]        List all the included files that could not be found.
  5106.             {not in Vi}
  5107.  
  5108. :che[ckpath]!        List all the included files.  {not in Vi}
  5109.  
  5110.  
  5111. 9. Inserting text                    *inserting*
  5112. =================
  5113.  
  5114. The following commands can be used to insert new text into the buffer.  They
  5115. can all be undone.  The non-Ex commands can be repeated with the "." command.
  5116.  
  5117.                             *a*
  5118. a            Append text after the cursor [count] times.
  5119.  
  5120.                             *A*
  5121. A            Append text at the end of the line [count] times.
  5122.  
  5123. <Insert>    or                *i* *insert* *<Insert>*
  5124. i            Insert text before the cursor [count] times.
  5125.  
  5126.                             *I*
  5127. I            Insert text before the first CHAR on the line
  5128.             [count] times.
  5129.  
  5130.                             *gI*
  5131. gI            Insert text in column 1 [count] times.  {not in Vi}
  5132.  
  5133.                             *o*
  5134. o            Begin a new line below the cursor and insert text,
  5135.             repeat [count] times.  {Vi: blank [count] screen
  5136.             lines}
  5137.  
  5138.                             *O*
  5139. O            Begin a new line above the cursor and insert text,
  5140.             repeat [count] times.  {Vi: blank [count] screen
  5141.             lines}
  5142.  
  5143. These commands are used to start inserting text.  They can be undone and
  5144. repeated.  You can end Insert mode with <Esc>.  See the section "Insert and
  5145. Replace mode" |mode_ins_repl| for the other special characters in Insert
  5146. mode.  The effect of [count] takes place after Insert mode is exited.
  5147.  
  5148. When 'autoindent' is on, the indent for a new line is obtained from the
  5149. previous line.  When 'smartindent' or 'cindent' is on, the indent for a line
  5150. is automatically adjusted for C programs.
  5151.  
  5152. 'textwidth' can be set to the maximum width for a line.  When a line becomes
  5153. too long when appending characters a line break is automatically inserted.
  5154.  
  5155.                             *:r* *:read*
  5156. :r[ead] [name]        Insert the file [name] (default: current file) below
  5157.             the cursor.
  5158.  
  5159. :{range}r[ead] [name]    Insert the file [name] (default: current file) below
  5160.             the specified line.
  5161.  
  5162.                             *:r!* *:read!*
  5163. :r[ead] !{cmd}        Execute {cmd} and insert its standard output below
  5164.             the cursor.  A temporary file is used to store the
  5165.             output of the command which is then read into the
  5166.             buffer.  'shellredir' is used to save the output of
  5167.             the command, which can be set to include stderr or
  5168.             not.  {cmd} is executed like with ":!{cmd}", any '!'
  5169.             is replaced with the previous command |:!|.
  5170.  
  5171. These commands insert the contents of a file, or the output of a command,
  5172. into the buffer.  They can be undone.  They cannot be repeated with the "."
  5173. command.  They work on a line basis, insertion starts below the line in which
  5174. the cursor is, or below the specified line.  To insert text above the first
  5175. line use the command ":0r {name}".
  5176.  
  5177.                             *textmode_read*
  5178. The <NL> character is recognized as end-of-line marker.  If the 'textmode'
  5179. option is on, a <CR> in front of an <NL> is ignored and a CTRL-Z at the end
  5180. of the file is ignored.  The 'textmode' option is default on for MS-DOS, Win32
  5181. and OS/2.
  5182.  
  5183. If the 'textauto' option is on Vim tries to recognize the type of end-of-line
  5184. marker (see |textmode_io|).  However, the 'textmode' option will not be
  5185. changed.  Only while reading the file the text mode is used or not.
  5186.  
  5187. On non-MS-DOS, Win32, and OS/2 systems the message "[textmode]" is shown if a
  5188. file is read in text mode, to remind you that something unusual is done.  On
  5189. MS-DOS, Win32, and OS/2 the message "[notextmode]" is shown if a file is read
  5190. without text mode.
  5191.  
  5192. An example on how to use ":r !":
  5193.     :r !uuencode binfile binfile
  5194. This command reads "binfile", uuencodes it and reads it into the current
  5195. buffer.  Useful when you are editing e-mail and want to include a binary
  5196. file.
  5197.  
  5198.  
  5199. 10. Deleting text                    *deleting*
  5200. =================
  5201.  
  5202. ["x]<Del>    or                    *<Del>* *x* *dl*
  5203. ["x]x            Delete [count] characters under and after the cursor
  5204.             [into register x] (not linewise).  Does the same as
  5205.             "dl".  See |:fixdel| if the <Del> key does not do what
  5206.             you want.  Also see |'whichwrap'|.  {<Del> not in Vi}
  5207.  
  5208.                             *X* *dh*
  5209. ["x]X            Delete [count] characters before the cursor [into
  5210.             register x] (not linewise).  Does the same as "dh".
  5211.             Also see |'whichwrap'|.
  5212.  
  5213.                             *d*
  5214. ["x]d{motion}        Delete text that is moved over [into register x].
  5215.             See below for exception.
  5216.  
  5217.                             *dd*
  5218. ["x]dd            Delete [count] lines [into register x] (linewise).
  5219.  
  5220.                             *D*
  5221. ["x]D            Delete the characters under the cursor until the end
  5222.             of the line and [count]-1 more lines [into register
  5223.             x]; synonym for d$ (not linewise).
  5224.  
  5225. {Visual}["x]x    or                    *v_x* *v_d*
  5226. {Visual}["x]d        Delete the highlighted text [into register x] (see
  5227.             the chapter on Visual mode |Visual_mode|).  {not in
  5228.             Vi}
  5229.  
  5230. {Visual}["x]X    or                    *v_X* *v_D*
  5231. {Visual}["x]D        Delete the highlighted lines [into register x] (see
  5232.             the chapter on Visual mode |Visual_mode|).  {not in
  5233.             Vi}
  5234.  
  5235.                             *:d* *:delete*
  5236. :[range]d[elete] [x]    Delete [range] lines (default: current line) [into
  5237.             register x].
  5238.  
  5239. :[range]d[elete] [x] {count}
  5240.             Delete {count} lines, starting with [range]
  5241.             (default: current line |cmdline_ranges|) [into
  5242.             register x].
  5243.  
  5244. These commands delete text.  They can be repeated with the "." command
  5245. (except ":d") and undone.  Use Visual mode to delete blocks of text.  See
  5246. |registers| for an explanation of registers.
  5247.  
  5248. An exception for the d{motion} command: If the motion is not linewise, the
  5249. start and end of the motion are not in the same line and before the start
  5250. and after the end are only blanks, the delete becomes linewise.  This means
  5251. that the blank line that would remain is also deleted.
  5252.  
  5253.  
  5254.                             *J*
  5255. J            Join [count] lines, with a minimum of two lines.
  5256.  
  5257.                             *v_J*
  5258. {Visual}J        Join the highlighted lines, with a minimum of two
  5259.             lines.  {not in Vi}
  5260.  
  5261.                             *:j* *:join*
  5262. :[range]j[oin][!]    Join [range] lines.  Same as "J", except when [!] is
  5263.             given, then no spaces will be inserted or deleted.
  5264.             When [range] is given and the start and end of the
  5265.             range are equal, nothing happens.  Default is to join
  5266.             two lines.
  5267.  
  5268. :[range]j[oin][!] {count}
  5269.             Join {count} lines, starting with [range] (default:
  5270.             current line |cmdline_ranges|).  Same as "J", except
  5271.             when [!] is given, then no spaces will be inserted
  5272.             or deleted.
  5273.  
  5274. These commands delete the newline between lines.  This has the effect of
  5275. joining them into one line.  They can be repeated (except ":j") and undone.
  5276.  
  5277. One space is inserted in place of the <NL>, unless the line ended with a
  5278. space, <Tab> or the next line started with a ')'.  If the next line has
  5279. leading white space it is deleted first.  If the 'joinspaces' option is on,
  5280. two spaces are inserted after a period.
  5281.  
  5282.  
  5283. 11. Changing text                    *changing*
  5284. =================
  5285.  
  5286. The following commands can be used to change text, that is delete some text
  5287. and insert something else, with one command.  They can all be undone.  The
  5288. non-Ex commands can be repeated with the "." command.
  5289.  
  5290.  
  5291. 11.1 Delete and insert                    *delete_insert*
  5292.  
  5293.                             *R*
  5294. R            Enter Replace mode: Each character you type replaces
  5295.             an existing character, starting with the character
  5296.             under the cursor.  Repeat the entered text [count]-1
  5297.             times.
  5298.  
  5299.                             *c*
  5300. ["x]c{motion}        Delete {motion} text [into register x] and start
  5301.             insert.
  5302.  
  5303.                             *cc*
  5304. ["x]cc            Delete [count] lines [into register x] and start
  5305.             insert (linewise).  If 'autoindent' is on, preserve
  5306.             the indent of the first line.
  5307.  
  5308.                             *C*
  5309. ["x]C            Delete from the cursor position to the end of the
  5310.             line and [count]-1 more lines [into register x], and
  5311.             start insert.  Synonym for c$ (not linewise).
  5312.  
  5313.                             *s*
  5314. ["x]s            Delete [count] characters [into register x] and start
  5315.             insert (s stands for Substitute).  Synonym for "cl"
  5316.             (not linewise).
  5317.  
  5318.                             *S*
  5319. ["x]S            Delete [count] lines [into register x] and start
  5320.             insert.  Synonym for "cc" (not linewise).
  5321.  
  5322. {Visual}["x]c    or                    *v_c* *v_r*
  5323. {Visual}["x]r        Delete the highlighted text [into register x] and
  5324.             start insert (see the chapter on Visual mode
  5325.             |Visual_mode|).  {not in Vi}
  5326.  
  5327. {Visual}["x]C    or                    *v_C* *v_R*
  5328. {Visual}["x]R        Delete the highlighted lines [into register x] and
  5329.             start insert (see the chapter on Visual mode
  5330.             |Visual_mode|).  {not in Vi}
  5331.  
  5332. Notes:
  5333. - You can end Insert and Replace mode with <Esc>.
  5334. - See the section "Insert and Replace mode" |mode_ins_repl| for the other
  5335.   special characters in these modes.
  5336. - The effect of [count] takes place after Insert or Replace mode is exited.
  5337. - When the 'cpoptions' option contains '$', and the change is within one line,
  5338.   the text is not directly deleted, but a '$' is put at the last deleted
  5339.   character.
  5340.  
  5341. See |registers| for an explanation of registers.
  5342.  
  5343. Replace mode is just like Insert mode, except that for every character you
  5344. enter, one character is deleted.  If the end of a line is reached, further
  5345. characters are appended (just like Insert mode).  In Replace mode the
  5346. backspace key restores the original text (if there was any) (see section
  5347. "Insert and Replace mode" |mode_ins_repl|).
  5348.  
  5349.                         *cw* *cW*
  5350. Special case: "cw" and "cW" are treated like "ce" and "cE" if the cursor is
  5351. on a non-blank.  This is because "cw" is interpreted as change-word, and a
  5352. word does not include the following white space.  {Vi: "cw" when on a blank
  5353. followed by other blanks changes only the first blank; this is probably a
  5354. bug, because "dw" deletes all the blanks}
  5355.  
  5356.  
  5357. 11.2 Simple changes                    *simple_change*
  5358.  
  5359.                             *r*
  5360. r{char}            Replace the character under the cursor with {char}.  If
  5361.             {char} is a <CR> or <NL> the character will be
  5362.             replaced with a line break.  Replacing with a real <CR>
  5363.             can be done by using CTRL-V <CR>.  CTRL-V <NL> will
  5364.             replace with a <Nul>.  {Vi: CTRL-V <CR> still replaces
  5365.             with a line break, cannot replace something with a
  5366.             <CR>}
  5367.             If a [count] is given that many characters will be
  5368.             replaced with [count] {char}s.  When {char} is a <CR>
  5369.             or <NL> only one is inserted.  "5r<CR>" replaces five
  5370.             characters with a single line break;
  5371.             When replacing with a <CR> or <NL> autoindenting is
  5372.             done.  This works just like deleting the characters
  5373.             that are replaced and then doing "i<CR><Esc>".
  5374.  
  5375.                             *~*
  5376. ~            'notildeop' option: switch case of the character
  5377.             under the cursor and move the cursor to the right.
  5378.             If a [count] is given do that many characters {Vi:
  5379.             no count}
  5380.  
  5381. ~{motion}        'tildeop' option: switch case of {motion} text.  {Vi:
  5382.             tilde cannot be used as an operator}
  5383.  
  5384.                             *g~*
  5385. g~{motion}        switch case of {motion} text.  {Not in Vi}
  5386.  
  5387.                             *v_~*
  5388. {Visual}~        switch case of highlighted text (see the chapter on
  5389.             Visual mode |Visual_mode|).  {not in Vi}
  5390.  
  5391.                             *v_U*
  5392. {Visual}U        Make highlighted text uppercase (see the chapter on
  5393.             Visual mode |Visual_mode|).  {not in Vi}
  5394.  
  5395.                             *gU*
  5396. gU{motion}        Make {motion} text uppercase.  {not in Vi}
  5397.  
  5398.                             *v_u*
  5399. {Visual}u        Make highlighted text lowercase (see the chapter on
  5400.             Visual mode |Visual_mode|).  {not in Vi}
  5401.  
  5402.                             *gu*
  5403. gu{motion}        Make {motion} text lowercase.  {not in Vi}
  5404.  
  5405.                             *CTRL-A*
  5406. CTRL-A            Add [count] to the number at or after the cursor.
  5407.             {not in Vi}
  5408.  
  5409.                             *CTRL-X*
  5410. CTRL-X            Subtract [count] from the number at or after the
  5411.             cursor.  {not in Vi}
  5412.  
  5413. The CTRL-A and CTRL-X commands work for (signed) decimal numbers and
  5414. unsigned octal and hexadecimal numbers.  Numbers starting with '0x' or '0X'
  5415. are assumed to be hexadecimal.  To decide whether the hexadecimal number
  5416. should be printed uppercase or not, the case of the rightmost letter in the
  5417. number is considered.  If there is no letter in the current number, the
  5418. previously detected case is used.  Numbers starting with a '0' are considered
  5419. to be octal.  Other numbers are decimal and may be preceded with a minus
  5420. sign.  If the cursor is on a number, that one will be used.  Otherwise the
  5421. number right of the cursor will be used.
  5422.  
  5423. For octal and hexadecimal numbers with leading zeros, the number of
  5424. characters in the number remains equal (when possible).  When doing CTRL-A on
  5425. "0077" it becomes "0100", CTRL-X on "0x0100" becomes "0x00ff".  Note that
  5426. when there are no leading zeros this does not work, so CTRL-X on "0x100"
  5427. results in "0xff".  Note that decimal numbers with leading zeros are
  5428. impossible, because they are recognized as octal numbers.
  5429.  
  5430. The CTRL-A command is very useful in a macro.  Example: How to make a
  5431. numbered list.
  5432.  
  5433. 1. Create the first entry.  The entry should start with a number.
  5434. 2. qa         - start recording into buffer 'a'
  5435. 3. Y         - yank the entry
  5436. 4. p         - put a copy of the entry below the first one
  5437. 5. CTRL-A    - increment the number
  5438. 6. q         - stop recording
  5439. 7. <count>@a - repeat the yank, put and increment <count> times
  5440.  
  5441.                             *<*
  5442. <{motion}        Shift the {motion} lines one 'shiftwidth' leftwards.
  5443.  
  5444.                             *<<*
  5445. <<            Shift [count] lines one 'shiftwidth' leftwards.
  5446.  
  5447.                             *v_<*
  5448. {Visual}[count]<    Shift the highlighted lines [count] 'shiftwidth'
  5449.             leftwards (see the chapter on Visual mode
  5450.             |Visual_mode|).  {not in Vi}
  5451.  
  5452.                             *>*
  5453. >{motion}        Shift {motion} lines one 'shiftwidth' rightwards.
  5454.  
  5455.                             *>>*
  5456. >>            Shift [count] lines one 'shiftwidth' rightwards.
  5457.  
  5458.                             *v_>*
  5459. {Visual}[count]>    Shift the highlighted lines [count] 'shiftwidth'
  5460.             rightwards (see the chapter on Visual mode
  5461.             |Visual_mode|).  {not in Vi}
  5462.  
  5463.                             *:<*
  5464. :[range]<        Shift [range] lines one 'shiftwidth' left.  Repeat '<'
  5465.             for shifting multiple 'shiftwidth's.
  5466.  
  5467. :[range]< {count}    Shift {count} lines one 'shiftwidth' left, starting
  5468.             with [range] (default current line |cmdline_ranges|).
  5469.             Repeat '<' for shifting multiple 'shiftwidth's.
  5470.  
  5471. :[range]le[ft] [indent]    left align lines in [range].  Sets the indent in the
  5472.             lines to [indent] (default 0).  {not in Vi}
  5473.  
  5474.                             *:>*
  5475. :[range]>        Shift {count} [range] lines one 'shiftwidth' right.
  5476.             Repeat '>' for shifting multiple 'shiftwidth's.
  5477.  
  5478. :[range]> {count}    Shift {count} lines one 'shiftwidth' right, starting
  5479.             with [range] (default current line |cmdline_ranges|).
  5480.             Repeat '>' for shifting multiple 'shiftwidth's.
  5481.  
  5482. The ">" and "<" commands are handy for changing the indent within programs.
  5483. The size of the white space which is inserted or deleted can be set with the
  5484. 'shiftwidth' option.  Normally the 'shiftwidth' option is 8, but you can set it
  5485. to, say, 3 to make smaller indents.  The shift leftwards stops when there is no
  5486. indent.  The shift right does not do anything with empty lines.
  5487.  
  5488. If the 'shiftround' option is on, the indent is rounded to a multiple of
  5489. 'shiftwidth'.
  5490.  
  5491. If the 'smartindent' option is on, or 'cindent' is on and 'cinkeys' contains
  5492. '#', lines starting with '#' will not be shifted right (they are supposed to
  5493. be C preprocessor lines that must stay in column 1).
  5494.  
  5495. When the 'expandtab' option is off (this is the default) <Tab>s are used as
  5496. much as possible to make the indent.  You can use ">><<" to replace an indent
  5497. made out of spaces with the same indent made out of <Tab>s (and a few
  5498. spaces if necessary).  If the 'expandtab' option is on, only spaces are
  5499. used.  Then you can use ">><<" to replace <Tab>s in the indent by spaces (or
  5500. use ":retab!").
  5501.  
  5502. To move a line several 'shiftwidth's use the Visual mode or the ":"
  5503. commands.  For example:
  5504.     Vjj4>        move three lines 4 indents to the right
  5505.     :<<<        move current line 3 indents to the left
  5506.     :>> 5        move 5 lines 2 indents to the right
  5507.     :5>>        move line 5 2 indents to the right
  5508.  
  5509.  
  5510. 11.3 Complex changes                    *complex_change*
  5511.  
  5512.                             *!*
  5513. !{motion}{filter}    Filter {motion} text through the external program
  5514.             {filter}.
  5515.  
  5516.                             *!!*
  5517. !!{filter}        Filter [count] lines through the external program
  5518.             {filter}.
  5519.  
  5520.                             *v_!*
  5521. {Visual}!{filter}    Filter the highlighted lines through the external
  5522.             program {filter} (see the chapter on Visual mode
  5523.             |Visual_mode|).  {not in Vi}
  5524.  
  5525. :{range}![!]{filter} [!][arg]                *:range!*
  5526.             Filter {range} lines through the external program
  5527.             {filter}.  The optional bangs are replaced with the
  5528.             latest given command.  The optional [arg] is
  5529.             appended.  The output of the filter command is
  5530.             temporaryly saved in a file and then read into the
  5531.             buffer.  The 'shellredir' option is used to write the
  5532.             output of the filter in the temporary file.
  5533.  
  5534.                             *=*
  5535. ={motion}        Filter {motion} lines through the external program
  5536.             given with the 'equalprg' option.  When the 'equalprg'
  5537.             option is empty (this is the default), use the
  5538.             internal formatting function to set the indent of each
  5539.             line |C_indenting|.
  5540.  
  5541.                             *==*
  5542. ==            Filter [count] lines through the external program
  5543.             given with the 'equalprg' option.  When the 'equalprg'
  5544.             option is empty (this is the default), use the
  5545.             internal formatting function |C_indenting|.
  5546.  
  5547.                             *v_=*
  5548. {Visual}=        Filter the highlighted lines through the external
  5549.             program given with the 'equalprg' option.  When the
  5550.             'equalprg' option is empty (this is the default),
  5551.             use the internal formatting function |C_indenting|.
  5552.             (see the chapter on Visual mode |Visual_mode|).  {not
  5553.             in Vi}
  5554.  
  5555. A filter is a program that accepts text at standard input, changes it in some
  5556. way, and sends it to standard output.  The commands above can be used to send
  5557. some text through a filter.  An example of a filter is "sort", which sorts
  5558. lines alphabetically.  The "indent" program is used to pretty indent C programs
  5559. (you need a version of indent that works like a filter, not all versions do
  5560. that).  The shell, given with the 'shell' option, is used to execute the
  5561. command (See also the 'shelltype' option).  The filter commands can be redone
  5562. with ".".  There cannot be a comment (with '"') after the ":!" command.
  5563.  
  5564.  
  5565.                         *:s* *:substitute*
  5566. :[range]s[ubstitute]/{pattern}/{string}/[g][c][r][p] [count]
  5567.             For each line in [range] replace {pattern} with
  5568.             {string}.  See below for the flags.
  5569.  
  5570. :[range]s[ubstitute] [g][c][r] [count]
  5571. :[range]&[g][c][r] [count]            *:&*
  5572.             Repeat last :substitute with same search pattern and
  5573.             substitute string.  The flags may be different (see
  5574.             below).
  5575.  
  5576. :[range]~[g][c][r] [count]            *:~*
  5577.             Repeat last substitute with same substitute string
  5578.             but with last used search pattern.  This is like
  5579.             "&r".  See explanation for [r] below.
  5580.  
  5581.                         *&*
  5582. &            Synonym for ":s//~/" (repeat last substitute).
  5583.  
  5584. The arguments that can be given to the substitute commands:
  5585. [g]    All occurrences in the line are replaced.  Otherwise only the first
  5586.     occurrence in the line is replaced.  If the 'edcompatible' option is
  5587.     on this flag is remembered and toggled each time it is used.  It is
  5588.     reset when a new search pattern is given.  If the 'gdefault' option
  5589.     is on, this flag is default on, give the [g] to switch it off.
  5590. [c]    Each substitute has to be confirmed.  The cursor is positioned on the
  5591.     matching string.  You can type:                *:s_c*
  5592.         'y'        to substitute this match
  5593.         'n'        to skip this match
  5594.         <Esc>   to skip this match
  5595.         'a'        to substitute this and all remaining matches {not in Vi}
  5596.         'q'        to quit substituting {not in Vi}
  5597.         CTRL-E  to scroll the screen up {not in Vi}
  5598.         CTRL-Y  to scroll the screen down {not in Vi}.
  5599.     If the 'edcompatible' option is on the [c] flag is remembered and
  5600.     toggled each time it is used.  It is reset when a new search pattern
  5601.     is given.
  5602. [r]    When the search pattern is empty use the previously used search
  5603.     pattern instead of the search pattern from the last substitute or
  5604.     ":global".  If the last command that did a search was a substitute or
  5605.     ":global" there is no effect.  If the last command was a search
  5606.     command, like "/", the pattern from that command is used.
  5607. [p]    Print the line containing the last substitute.
  5608. [count] That many lines are are searched, starting with the last line number
  5609.     in [range] (default current line |cmdline_ranges|).
  5610.  
  5611. If the {pattern} for the substitute command is empty, the pattern from the
  5612. last substitute or ":global" command is used.  With the [r] flag the pattern
  5613. from the last substitute, ":global" or search command is used.
  5614.  
  5615. For compatibility with Vi these two execptions are allowed:
  5616. "\/{string}/" and "\?{string}?" do the same as "//{string}/r".
  5617. "\&{string}&" does the same as "//{string}/".
  5618.  
  5619. Instead of the '/' which surrounds the pattern and replacement string, you
  5620. can use any other character, but not an alphanumeric character, '"' or '|'
  5621. or '#'.  This is useful if you want to include a '/' in the search pattern or
  5622. replacement string.  Example: ":s+/+//+"
  5623.  
  5624. For the definition of a pattern see 6.6, "Pattern searches" |search_pattern|.
  5625.  
  5626. Some characters in {string} have a special meaning:
  5627.  
  5628. magic    nomagic      action
  5629.   &      \&      replaced with the whole matched pattern
  5630.  \&       &      replaced with &
  5631.       \0      replaced with the whole matched pattern
  5632.       \1      replaced with the matched pattern in the first pair of ()
  5633.       \2      replaced with the matched pattern in the second pair of ()
  5634.       ..      ..
  5635.       \9      replaced with the matched pattern in the ninth pair of ()
  5636.   ~      \~      replaced with the {string} of the previous substitute
  5637.  \~       ~      replaced with ~
  5638.       \u      next character made uppercase
  5639.       \U      following characters made uppercase
  5640.       \l      next character made lowercase
  5641.       \L      following characters made lowercase
  5642.       \e      end of /u, /U, /l and /L (NOTE: not <Esc>!)
  5643.       \E      end of /u, /U, /l and /L
  5644.       <CR>      split line in two at this point
  5645.       \r      idem
  5646.       \n      <NL>
  5647.       \b      <BS>
  5648.       \t      <Tab>
  5649.   CTRL-V <CR>      insert a carriage-return (CTRL-M)
  5650.  
  5651. Examples:
  5652. :s/a\|b/xxx\0xxx/g          modifies "a b"      in "xxxaxxx xxxbxxx"
  5653. :s/\([abc]\)\([efg]\)/\2\1/g  modifies "af fa bg" in "fa fa gb"
  5654. :s/abcde/abc^Mde/          modifies "abcde"      in "abc", "de" (two lines)
  5655. :s/$/^V^M/              modifies "abcde"      in "abcde^M"
  5656.  
  5657. Note: To insert a ^M you have to type CTRL-V <CR>.  To insert a ^V you have
  5658. to type CTRL-V CTRL-V.  So to insert the ^V^M in the last example you have to
  5659. type CTRL-V CTRL-V CTRL-V <CR>.
  5660.  
  5661. Because CTRL-V <CR> inserts a <CR>, it is impossible to insert a CTRL-V just
  5662. in front of a line break.  You will have to split it up in two parts:
  5663.     :s/foo/^Vxxxx/
  5664.     :s/xxxx/^M/
  5665.  
  5666. When using parentheses in combination with '|', like in \([ab]\)\|\([cd]\),
  5667. either the first or second pattern in parentheses did not match, so either
  5668. \1 or \2 is empty.  Example:
  5669. :s/\([ab]\)\|\([cd]\)/\1x/g   modifies "a b c d"  in "ax bx x x"
  5670.  
  5671.                             *:ret* *:retab*
  5672. :[range]ret[ab][!] [new_tabstop]
  5673.             All sequences of white-space containing a tab are
  5674.             replaced with new strings of white-space using the new
  5675.             tabstop value given.  If no new tabstop size is
  5676.             given, the current value of 'tabstop' is used.  With
  5677.             !, strings of normal spaces will also be replace with
  5678.             tabs where appropriate.  With 'expandtab' on, all
  5679.             tabs will be replaced with the appropriate number of
  5680.             spaces.  This command sets 'tabstop' to the new
  5681.             value given, and if performed on the whole file,
  5682.             which is default, should not make any visible
  5683.             change.  Careful: In a C program a <Tab> inside a
  5684.             string will also be affected.  Use "\t" to avoid this
  5685.             (that's a good habit anyway).  {not in Vi}
  5686.  
  5687.  
  5688. 11.4 Formatting text                        *formatting*
  5689.  
  5690. :[range]ce[nter] [width]                *:ce* *:center*
  5691.             Center lines in [range] between [width] columns
  5692.             (default 'textwidth' or 80 when 'textwidth' is 0).
  5693.             {not in Vi}
  5694.  
  5695. :[range]ri[ght] [width]                    *:ri* *:right*
  5696.             right align lines in [range] at [width] columns
  5697.             (default 'textwidth' or 80 when 'textwidth' is 0).
  5698.             {not in Vi}
  5699.  
  5700.                             *:le* *:left*
  5701. :[range]le[ft] [indent]    left align lines in [range].  Sets the indent in the
  5702.             lines to [indent] (default 0).  {not in Vi}
  5703.  
  5704. gq{motion}                        *Q* *gq*
  5705. Q{motion}        Format the lines that were moved over.  The length of
  5706.             each line will be restricted to the width given with
  5707.             the 'textwidth' option.  See below.  If the
  5708.             'textwidth' option is 0, the width of the screen is
  5709.             used (with a maximum of 79).  {not in Vi}
  5710.             NOTE: The "Q" command is used in Vi to go to Ex mode.
  5711.             In a future version of Vim this will be made
  5712.             compatible.  Use "gq" for formatting now, to avoid
  5713.             problems when upgrading to a newer version of Vim.
  5714.  
  5715. {Visual}gq                            *v_Q* *v_gq*
  5716. {Visual}Q        Format the highlighted text.  (see the chapter on
  5717.             Visual mode |Visual_mode|).  {not in Vi}
  5718.  
  5719. Example: To format the current paragraph use "gqp".
  5720.  
  5721. After the "gq" command the cursor is left in the line where the motion command
  5722. would take the cursor.  This allows for the formatting to be repeated with
  5723. ".".  This works fine with "gqj" (format current and next line) and "gq}"
  5724. (format until end of paragraph).  Note: When 'formatprg' is set, the cursor is
  5725. left on the first formatted line (like when using a filter command).
  5726.  
  5727. If the 'autoindent' option is on, the indent of the first line is used for
  5728. the following lines.
  5729.  
  5730. Empty lines are left unchanged (but lines with spaces or tabs are!).
  5731.  
  5732. The 'formatprg' option can be set to the name of an external program, which
  5733. will be used instead of the internal function.  The 'textwidth' and other
  5734. options will not be used then.
  5735.  
  5736.                             *format_comments*
  5737. Comments can be formatted in a special way.  A comment is recognized by a
  5738. specific string at the start of the line (ignoring white space).  Three types
  5739. of comments can be used:
  5740.  
  5741. - Repeating the comment string at the start of each line.  An example is the
  5742.   type of comment used in shell scripts, starting with "#".
  5743. - Only the first line has the comment string, following lines don't.  An
  5744.   example is this list with dashes.
  5745. - Three-piece comments, that have a start string, an end string and optional
  5746.   lines in between.  The strings for the start, middle and end are different.
  5747.   An example is the C-style comment:
  5748.       /*
  5749.      *  this is a C comment
  5750.      */
  5751.  
  5752. The 'comments' option can be set to a comma separated list of parts.  Each
  5753. part defines a type of comment that is recognized.  A part consists of:
  5754.     {flags}:{string}
  5755.  
  5756. {string} is the literal text that must appear.
  5757.  
  5758. {flags}:
  5759.   n    Nested comment.  Nesting with mixed parts is allowed.  If 'comments'
  5760.     is "n:),n:>" a line starting with "> ) >" is accepted as comment.
  5761.  
  5762.   b    Blank (<Space>, <Tab> or end-of-line) required after {string}.
  5763.  
  5764.   f    First line has comment only, will not be repeated on next line, but
  5765.     indent is kept (for bullet-lists).
  5766.   s    Start of three-piece comment
  5767.   m    Middle of a three-piece comment
  5768.   e    End of a three-piece comment
  5769.  
  5770.   l    Left adjust middle with start or end (default).  Only recognized when
  5771.       used together with 's' or 'e'.
  5772.   r    Right adjust middle with start or end.  Only recognized when used
  5773.       together with 's' or 'e'.
  5774.  
  5775. When neither 'f', 's', 'm' or 'e' is given, a repeated comment string is
  5776. assumed.  It is possible to have an empty flags field.
  5777.  
  5778. Blank space in the text before and after the {string} is also included.  The
  5779. {string} in the 'comments' option should not include leading or trailing
  5780. blanks (although it is allowed, in which case they are required).
  5781.  
  5782. When one comment leader is part of another, put it after that one.  For
  5783. example, to include both "-" and "->", use
  5784.     :set comments=f:->,f:-
  5785.  
  5786. A three-piece comment must always be given as start-middle-end, with no other
  5787. parts in between.  An example of a three-piece comment is "sr:/*,mb:*,el:*/" for
  5788. C-comments.  To avoid recognizing "*ptr" the 'b' flag is included for the
  5789. middle.  For three-piece comments the text after the start and middle is
  5790. checked for the appearance of the end.  If it is, the comment will not
  5791. continue below.  The middle part must be present, because otherwise Vim can't
  5792. recognize the middle lines.
  5793.  
  5794. Examples:
  5795. "b:*"    Includes lines starting with "*", but not if the "*" is followed by a
  5796.     non-blank.  This avoids a pointer dereference like "*str" to be
  5797.     recognized as a comment.
  5798. "n:>"    Includes a line starting with ">", ">>", ">>>", etc.
  5799. "fb:-"    Format a list that starts with "- ".
  5800.  
  5801. By default, "b:#" is included.  This means that a line that starts with
  5802. "#include" is not recognized as a comment line.  But a line that starts with
  5803. "# define" is recognized.  In C code this is good, because somewhere after this
  5804. a "#endif" is needed.
  5805.  
  5806.                             *fo_table*
  5807. The 'formatoptions' option can be set to influence the way how comments are
  5808. formatted.  It is a string option, that may contain any of these letters.  The
  5809. default is "tcq".  Commas can be added for readability.
  5810.  
  5811. letter     meaning when present in 'formatoptions'
  5812.  
  5813. t    Do text autowrapping using textwidth
  5814. c    Do comment autowrapping using textwidth, inserting the current
  5815.     comment leader automatically.
  5816. r    Automatically insert the current comment leader after hitting
  5817.     <return> in insert mode.
  5818. o    Automatically insert the current comment leader after hitting 'o' or
  5819.     'O' in Normal mode.
  5820. q    Allow formatting of comments with "gq" (or "Q", which is obsolete).
  5821.     Note that blank lines, or lines containing only the comment leader
  5822.     will be left untouched.  A new paragraph starts after such a line, or
  5823.     when the comment leader changes.
  5824. 2    When formatting text the indent of the second line of a paragraph is
  5825.     used for the rest of the paragraph.  This allows for paragraphs with
  5826.     a different indent for the first line.
  5827. v    Vi-compatible auto wrapping in insert mode: Only break a line at a
  5828.     blank that has been entered during the current insert command.  (Note:
  5829.     this is not 100% Vi compatible, Vi has some "unexpected features" or
  5830.     bugs in this area.  It uses the screen column instead of the line
  5831.     column)
  5832. b    Like 'v', but only auto wrap if a blank has been entered at or before
  5833.     the wrap margin.  If the line was longer than 'textwidth' when the
  5834.     insert started, or no blank was entered in the current insert before
  5835.     reaching 'textwidth', there is no auto wrapping.
  5836. l    Long lines are not broken in insert mode: When a line was longer than
  5837.     'textwidth' when the insert command started it is not automatically
  5838.     formatted.
  5839.  
  5840. With 't' and 'c' you can decide when auto-wrapping is done:
  5841. value    action
  5842. ""    no automatic formatting, "gq" can be used for manual formatting
  5843. "t"    automatic formatting of text, not for comments
  5844. "c"    automatic formatting for comments, not for text (good for C code)
  5845. "tc"    automatic formatting for text and comments
  5846.  
  5847. Note that when 'textwidth' is 0, no formatting is done anyway (but the comment
  5848. leader is inserted).
  5849. Note that when 'paste' is on, no formatting is done at all.
  5850. Note that 'textwidth' can be non-zero even though auto-wrapping never occurs.
  5851. This is good because it can be used for formatting only in this case (with
  5852. "gq").
  5853.  
  5854. If "/*", "*" and/or "*/" are in the 'comments' variable, then Vim has some
  5855. built in stuff to treat these types of comments a bit more cleverly.
  5856. Opening a new line before or after "/*" or "*/" (with 'r' or 'o' present in
  5857. 'formatoptions') gives the correct start of the line automatically.  The same
  5858. happens with formatting and auto-wrapping. Opening a line after a line
  5859. starting with "/*" or "*" and containing "*/", will cause no comment leader to
  5860. be inserted, and the indent of the new line is taken from the line containing
  5861. the start of the comment.
  5862. E.g.:
  5863.     /*
  5864.      * Your typical comment.
  5865.      */
  5866.     The indent on this line is the same as the start of the above
  5867.     comment.
  5868.  
  5869. All this should be really cool, especially in conjunction with the new
  5870. :autocmd command to prepare different settings for different types of file.
  5871.  
  5872. Some examples:
  5873.   for C code:        fo="croq"    (only format comments)
  5874.   for Mail/news:    fo="tcrq"    (format all, don't start comment with "o"
  5875.                   command)
  5876.  
  5877.  
  5878. 11.5 Indenting C programs                *C_indenting*
  5879.  
  5880. C programs can be automatically indented.  Only the indent is set, no other
  5881. formatting is done.  To format comments see |format_comments|.
  5882.  
  5883. There are in fact three methods that can be used.
  5884. 'autoindent'    Just takes the indent from the previous line.
  5885. 'smartindent'    Is like 'autoindent' but also recognizes some C syntax to
  5886.         increase/reduce the indent where appropriate.
  5887. 'cindent'    Works more clever than the other two and can be configured to
  5888.         different indenting styles.
  5889. The rest of this section is about the 'cindent' option.
  5890.  
  5891. Note that the indenting done with 'cindent' does not work for 100%.  Vim is
  5892. not a C compiler, not all syntax is recognized.
  5893.  
  5894. Four options are used for C program indenting:
  5895. 'cindent'    When on automatic C program indenting is enabled.
  5896. 'cinkeys'    Keys that trigger reindenting in insert mode.
  5897. 'cinoptions'    For setting your preferred indent style.
  5898. 'cinwords'    Defines keywords that start an extra indent in the next line.
  5899.  
  5900. If 'lisp' is not on and 'equalprg' is empty, the "=" operator indents using
  5901. this algorithm rather than calling an external program.
  5902.  
  5903. See |autocommand| for how to automatically set the 'cindent' option for C code
  5904. files and reset it for others.
  5905.  
  5906.                             *'cinkeys'* *'cink'*
  5907. The 'cinkeys' option can be set to a string that says when to do indenting.
  5908. The default is "0{,0},:,0#,!^F,o,O,e".  This means that indenting is done
  5909. when:
  5910.     "0{"    typing '{' as the first character in a line
  5911.     "0}"    typing '}' as the first character in a line
  5912.     ":"    typing ':' anywhere
  5913.     "0#"    typing '#' as the first character in a line
  5914.     "!^F"    typing CTRL-F, which is not inserted
  5915.     "o"    typing a <CR> anywhere and for the "o" command (not in insert
  5916.         mode!)
  5917.     "O"    for the "O" command (not in insert mode!)
  5918.     "e"    typing the second 'e' for an "else" at the start of a line
  5919.  
  5920. Characters that can be prepended:
  5921. '!'    When the key is preceded with a '!' the key will not be inserted but
  5922.     will just cause the current line to be reindented.  This allows you to
  5923.     set a command key for reindenting the current line.  By default CTRL-F
  5924.     is used for this.  Careful with CTRL-I, you might think that it is a
  5925.     nice command for Indenting, but it is the same as a <Tab>.
  5926. '*'    When the key is preceded with a '*' the reindenting will be done
  5927.     before inserting the key.  If you use "*<Return>" this means that the
  5928.     current line will be reindented, before opening a new line.
  5929.  
  5930. When the key is not preceded with a '!' or '*' the reindenting will be done
  5931. after inserting the key.  So ';' will set the indentation of the line
  5932. including the ';'.
  5933.  
  5934. '0'    When a zero is used before the key (but after '!' or '*') it will only
  5935.     trigger reindenting if the key is the first character typed in the
  5936.     line.
  5937.  
  5938. Special key names:
  5939. <>    Angle brackets mean spelled-out names of keys.  For example: "<Up>",
  5940.     "<Ins>".
  5941. '^'    Letters preceded by a caret (^) are control characters.  For example:
  5942.     "^F" is CTRL-F.
  5943. 'o'    Means to reindent a line for the "o" command and whenever a new
  5944.     line is opened below the current one.  This includes hitting <Return>
  5945.     in insert mode.
  5946. 'O'    Means to reindent a line for the "O" command.
  5947. 'e'    Means to reindent a line that starts with "else" when an 'e' is
  5948.     inserted.
  5949.  
  5950. If you really want to reindent when you type 'o', 'O', 'e', '0', '<', '>', '*'
  5951. or '!', use "<o>", "<O>", "<e>", "<0>", "<<>", "<>>", "<*>" or "<!>",
  5952. respectively, for those keys.
  5953.  
  5954. For an emacs-style indent mode, where lines aren't indented every time you
  5955. press Return but only if you press Tab, I suggest:
  5956.     :set cinkeys=0{,0},:,0#,!<Tab>,!^F
  5957.  
  5958. Note: When the indent of the current line was changed manually, cindenting
  5959. won't be done for any key.  This is to avoid re-indenting after you changed
  5960. the indent by typing <BS>, <Tab> or <Space> in the indent, or used CTRL-T or
  5961. CTRL-D.
  5962.  
  5963. How the indenting is done can be set with 'cinoptions'.  In the list below,
  5964. "N" represents a number of your choice.  It can be negative.  When there is an
  5965. 's' after the number, it is multiplied with 'shiftwidth'.  "1s" is
  5966. 'shiftwidth', "2s" is two times 'shiftwidth', etc.  A decimal point is allowed
  5967. too: "-0.5s" is minus half a 'shiftwidth'.  The examples given below assume a
  5968. 'shiftwidth' of 4.
  5969.  
  5970.     >N    Amount added for "normal" indent.  Used after a line that should
  5971.           increase the indent (lines starting with "if", an opening brace,
  5972.           etc.).  (default 'shiftwidth').
  5973.  
  5974.             cino=               cino=>2             cino=>2s
  5975.           if (cond)           if (cond)           if (cond)
  5976.           {                   {                   {
  5977.               foo;              foo;                      foo;
  5978.           }                   }                   }
  5979.  
  5980.     eN    Add N to the prevailing indent inside a set of braces if the
  5981.           opening brace at the End of the line (more precise: is not the
  5982.           first character in a line).  This is useful if you want a
  5983.           different indent when the '{' is at the start of the line from
  5984.           when '{' is at the end of the line.  (default 0).
  5985.  
  5986.             cino=               cino=e2             cino=e-2
  5987.               if (cond) {         if (cond) {         if (cond) {
  5988.                   foo;                  foo;            foo;
  5989.               }                   }                   }
  5990.               else                else                else
  5991.               {                   {                   {
  5992.                   bar;                bar;                bar;
  5993.               }                   }                   }
  5994.  
  5995.     nN    Add N to the prevailing indent for a statement after an "if",
  5996.           "while", etc., if it is Not inside a set of braces.  This is
  5997.           useful if you want a different indent when there is no '{'
  5998.           before the statement from when there is a '{' before it.
  5999.           (default 0).
  6000.  
  6001.             cino=               cino=n2             cino=n-2
  6002.               if (cond)           if (cond)           if (cond)
  6003.                   foo;                  foo;            foo;
  6004.               else                else                else
  6005.               {                   {                   {
  6006.                   bar;                bar;                bar;
  6007.               }                   }                   }
  6008.  
  6009.     fN    The First opening brace of a function or other block is placed
  6010.           in column N.  Only for an opening brace that is not inside other
  6011.           braces and is at the start of the line.  What comes after the
  6012.           brace is put relative to this brace.  (default 0).
  6013.  
  6014.             cino=               cino=f.5s           cino=f1s
  6015.           func()              func()              func()
  6016.           {                     {                     {
  6017.               int foo;              int foo;              int foo;
  6018.  
  6019.     {N    Opening braces are placed N characters from the prevailing
  6020.           indent.  Only for opening braces that are inside
  6021.           other braces.  (default 0).
  6022.  
  6023.             cino=               cino={.5s           cino={1s
  6024.           if (cond)           if (cond)           if (cond)
  6025.           {                     {                     {
  6026.               foo;                foo;                foo;
  6027.  
  6028.     }N    Closing braces are placed N characters from the matching opening
  6029.           brace.  (default 0).
  6030.  
  6031.             cino=               cino={2,}-0.5s      cino=}2
  6032.           if (cond)           if (cond)           if (cond)
  6033.           {                     {                 {
  6034.               foo;                foo;                foo;
  6035.           }                   }                     }
  6036.  
  6037.     ^N    Add N to the prevailing indent inside a set of braces if the
  6038.           opening brace is in column 0.  This is used to have a different
  6039.           indent for whole of a function (some may like to set it to a
  6040.           negative number).  (default 0).
  6041.  
  6042.         cino=               cino=^-2            cino=^-s
  6043.           func()              func()              func()
  6044.           {                   {                   {
  6045.               if (cond)         if (cond)         if (cond)
  6046.               {                {                 {
  6047.               a = b;            a = b;            a = b;
  6048.               }                }                 }
  6049.           }                   }                   }
  6050.  
  6051.     :N    Case labels are placed N characters from the indent of the
  6052.           switch().  (default 'shiftwidth').
  6053.  
  6054.             cino=               cino=:0
  6055.           switch (x)          switch(x)
  6056.           {              {
  6057.               case 1:         case 1:
  6058.                   a = b;          a = b;
  6059.               default:          default:
  6060.           }              }
  6061.  
  6062.     =N    Statements after a case label are placed N characters from the
  6063.           indent of the label.  (default 'shiftwidth').
  6064.  
  6065.             cino=               cino==10
  6066.            case 11:        case 11:  a = a + 1;
  6067.                a = a + 1;                 b = b + 1;
  6068.  
  6069.     pN    Parameter declarations for K&R-style function declarations will
  6070.           be indented N characters from the margin.  (default
  6071.           'shiftwidth').
  6072.  
  6073.             cino=               cino=p0             cino=p2s
  6074.           func(a, b)          func(a, b)          func(a, b)
  6075.               int a;          int a;                      int a;
  6076.               char b;         char b;                     char b;
  6077.  
  6078.     tN    Type for a function declaration will be indented N characters
  6079.           from the margin.  (default 'shiftwidth').
  6080.  
  6081.             cino=               cino=t0             cino=t7
  6082.               int             int                        int
  6083.           func()              func()              func()
  6084.  
  6085.     +N    Continuation lines (lines that spill onto two) are indented N
  6086.           additional characters.  (default 'shiftwidth').
  6087.  
  6088.             cino=                     cino=+10
  6089.           a = b + 9 *               a = b + 9 *
  6090.               c;                              c;
  6091.  
  6092.     cN    Comment lines after the comment opener, when there is no other
  6093.           text to line up with, are indented N characters from the comment
  6094.           opener.  (default 3).  See also |format_comments|.
  6095.  
  6096.             cino=                     cino=c5
  6097.           /*                        /*
  6098.              text.                       text.
  6099.            */                 */
  6100.  
  6101.     (N    When in unclosed parentheses, indent N characters from the line
  6102.           with the unclosed parentheses.  When N is 0 or the line starts
  6103.           with '(' line up with the unclosed parentheses.  (default
  6104.           'shiftwidth' * 2).
  6105.  
  6106.             cino=                     cino=(0
  6107.           if (c1 && (c2 ||          if (c1 && (c2 ||
  6108.                     c3))                         c3))
  6109.               foo;            foo;
  6110.           if (c1 &&            if (c1 &&
  6111.                   (c2 || c3)            (c2 || c3)
  6112.              }                         }
  6113.  
  6114.     )N    Unclosed parentheses will be searched for at most N lines away.
  6115.           This is just to limit the time needed to search for parentheses.
  6116.           (default 20 lines).
  6117.  
  6118.     *N    Unclosed comments will be searched for at most N lines away.
  6119.           This is just to limit the time needed to search for the start of
  6120.           a comment.  (default 30 lines).
  6121.  
  6122. The defaults, spelled out in full, would be
  6123.     cinoptions=>s,e0,n0,f0,{0,}0,^0,:s,=s,ps,ts,+s,(2s,)20,*30
  6124.  
  6125. Lines are put in column 1 if:
  6126. - It starts with '#' (preprocessor directives), if 'cinkeys' contains '#'.
  6127. - It starts with a label (a keyword followed by ':', other than "case" and
  6128.   "default").
  6129. - Any combination of indentations causes the line to have less than 0
  6130.   indentation.
  6131.  
  6132.  
  6133. 12. Copying and moving text                *copy_move*
  6134. ===========================
  6135.  
  6136.                             *quote*
  6137. "<a-zA-Z0-9.%:-">    Use register <a-zA-Z0-9.%:-"> for next delete, yank
  6138.             or put (use uppercase character to append with
  6139.             delete and yank) (<.%:> only work with put).
  6140.  
  6141.                             *:reg* *:registers*
  6142. :reg[isters]        Display the contents of all numbered and named
  6143.             registers.  {not in Vi}
  6144.  
  6145. :reg[isters] {arg}    Display the contents of the numbered and named
  6146.             registers that are mentioned in {arg}.  For example:
  6147.                 :dis 1a
  6148.             to display registers '1' and 'a'.  Spaces are allowed
  6149.             in {arg}.  {not in Vi}
  6150.  
  6151.                             *:di* *:display*
  6152. :di[splay] [arg]    Same as :registers.  {not in Vi}
  6153.  
  6154.                             *y*
  6155. ["x]y{motion}        Yank {motion} text [into register x].
  6156.  
  6157.                             *yy*
  6158. ["x]yy            Yank [count] lines [into register x] (linewise).
  6159.  
  6160.                             *Y*
  6161. ["x]Y            yank [count] lines [into register x] (synonym for
  6162.             yy, linewise).  If you like "Y" to work from the
  6163.             cursor to the end of line (which is more logical,
  6164.             but not Vi-compatible) use ":map Y y$".
  6165.  
  6166.                             *v_y*
  6167. {Visual}["x]y        Yank the highlighed text [into register x] (see the
  6168.             chapter on Visual mode |Visual_mode|).  {not in Vi}
  6169.  
  6170.                             *v_Y*
  6171. {Visual}["x]Y        Yank the highlighted lines [into register x] (see the
  6172.             chapter on Visual mode |Visual_mode|).  {not in Vi}
  6173.  
  6174.                             *:y* *:yank*
  6175. :[range]y[ank] [x]    Yank [range] lines [into register x].
  6176.  
  6177. :[range]y[ank] [x] {count}
  6178.             Yank {count} lines, starting with last line number
  6179.             in [range] (default: current line |cmdline_ranges|),
  6180.             [into register x].
  6181.  
  6182.                             *p*
  6183. ["x]p            Put the text [from register x] after the cursor
  6184.             [count] times.  {Vi: no count}
  6185.  
  6186. ["x]P            or                    *P* *<MiddleMouse>*
  6187. ["x]<MiddleMouse>    Put the text [from register x] before the cursor
  6188.             [count] times.  Using the mouse only works when
  6189.             'mouse' contains 'n' or 'a'.  {Vi: no count}
  6190.  
  6191.                             *:pu* *:put*
  6192. :[line]pu[t] [x]    Put the text [from register x] after [line] (default
  6193.             current line).
  6194.  
  6195. :[line]pu[t]! [x]    Put the text [from register x] before [line] (default
  6196.             current line).
  6197.  
  6198. ["x]]p            or                    *]p* *]<MiddleMouse>*
  6199. ["x]]<MiddleMouse>      Like "p", but adjust the indent to the current line.
  6200.             Using the mouse only works when 'mouse' contains 'n'
  6201.             or 'a'.  {not in Vi}
  6202.  
  6203. ["x][P            or                    *[P*
  6204. ["x]]P            or                    *]P*
  6205. ["x][p            or                    *[p* *[<MiddleMouse>*
  6206. ["x][<MiddleMouse>    Like "P", but adjust the indent to the current line.
  6207.             Using the mouse only works when 'mouse' contains 'n'
  6208.             or 'a'.  {not in Vi}
  6209.  
  6210. These commands can be used to copy text from one place to another.  This is
  6211. done by first getting the text into a register with a yank, delete or change
  6212. command.  The register can then be inserted with a put command.  All registers
  6213. are kept when changing files.  Thus you can also use this to move text from
  6214. one file to another (the CTRL-^ command is a quick way to toggle between two
  6215. files).
  6216.  
  6217. The put commands can be repeated with "." (except for :put) and undone.  If
  6218. the command that was used to get the text into the register was linewise, the
  6219. text will be inserted below ("p") or above ("P") the line where the cursor
  6220. is.  Otherwise the text will be inserted after ("p") or before ("P") the
  6221. cursor.  With the ":put" command the text will always be inserted in the next
  6222. line.  You can exchange two characters with the command sequence "xp".  You
  6223. can exchange two lines with the command sequence "ddp".  You can exchange
  6224. two words with the command sequence "deep" (start with the cursor in the
  6225. blank space before the first word).  The "']" or "`]" command can be used
  6226. after the put command to move the cursor to the end of the inserted text,
  6227. "'[" or "`[" to move the cursor to the start.
  6228.  
  6229. If the command that was used to get the text into the register used
  6230. blockwise Visual mode, the block of text will be inserted before ("P") or
  6231. after ("p") the cursor column, in the current and next lines.  Vim will make
  6232. the whole block of text start in the same column.  Thus the inserted text
  6233. looks the same as when it was yanked or deleted.  Some <Tab> characters may
  6234. be replaced with spaces to make this happen.  However, if the width of the
  6235. block is not a multiple of a <Tab> width and the text after the inserted
  6236. block contains <Tab>s, that text may be misaligned.
  6237.  
  6238. Rationale:    In Vi the "y" command followed by a backwards motion would
  6239.         sometimes not move the cursor to the first yanked character,
  6240.         because redisplaying was skipped.  In Vim it always moves to
  6241.         the first character, like specified by Posix.
  6242.  
  6243. There are five types of registers:            *registers*
  6244. - The unnamed register ""            *quote_quote* *quotequote*
  6245. - 10 numbered registers "0 to "9        *quote_number* *quote0*
  6246. - The small delete register "-            *quote_-* *quote-*
  6247. - 26 named registers "a to "z or "A to "Z    *quote_alpha* *quotea*
  6248. - three read-only registers ":, ". and "%
  6249.  
  6250.     The unnamed register is the register where all text deleted with
  6251. the "d", "c", "s", "x" commands or copied with the yank "y" command is
  6252. placed, regardless of whether or not a specific register was used (e.g.
  6253. "xdd).  The contents of this register are used by any put command (p or P)
  6254. which does not specify a register.  Additionally it can be accessed by the
  6255. name '"'.  This means you have to type two double quotes.  {Vi: register
  6256. contents lost when changing files, no '"'}
  6257.     The numbered registers are filled with yank and delete commands.
  6258. Numbered register 0 is filled with the last yank command, unless another
  6259. register was specified with ["x].  Numbered register 1 is filled with the text
  6260. that was deleted by each delete or change command, unless another register was
  6261. specified or the text is less than one line (text deleted with "x" or "dw"
  6262. will be put in the small delete register).  The contents of register 1 are put
  6263. in 2, 2 in 3, and so forth.  The contents of register 9 are lost.  {Vi:
  6264. numbered register contents are lost when changing files; register 0 does not
  6265. exist}
  6266.     The small delete register is filled with delete commands that delete
  6267. less than one line, except when a register was specified with ["x].
  6268.     The named registers are only filled when you say so.  They are named
  6269. 'a' to 'z' normally.  If you use an uppercase letter, the same registers as
  6270. with the lower case letter is used, but the text is appended to the previous
  6271. register contents.  With a lower case letter the previous contents are lost.
  6272.     The read-only registers are '%', ':' and '.'.  They can only be used
  6273. with the commands "p", "P", ":put" and with CTRL-R.
  6274.                             *quote_.* *quote.*
  6275.     ".    Contains the last inserted text (the same as what is inserted
  6276.         with the insert mode commands CTRL-A and CTRL-@).  Note: this
  6277.         doesn't work with CTRL-R on the command line.  It works a bit
  6278.         differently, like inserting the text instead of putting it
  6279.         ('textwidth' and other options affect what is inserted).
  6280.                             *quote_%* *quote%*
  6281.     "%    Contains the name of the current file.
  6282.                             *quote_:* *quote:*
  6283.     ":    Contains the last command line.  It can be used with "@:",
  6284.         this repeats the last command line.
  6285.  
  6286. If you use a put command without specifying a register, the register that
  6287. was last written to is used (this is also the contents of the unnamed
  6288. register).  If you are confused, use the ":dis" command to find out what will
  6289. be put (all named and numbered registers are displayed; the unnamed register
  6290. is labelled '"').
  6291.  
  6292. The next three commands always work on whole lines.
  6293.  
  6294. :[range]co[py] {address}                *:co* *:copy*
  6295.             Copy the lines given by [range] to below the line
  6296.             given by {address}.
  6297.  
  6298.                             *:t*
  6299. :t            Synonym for copy.
  6300.  
  6301. :[range]m[ove] {address}                *:m* *:move*
  6302.             Move the lines given by [range] to below the line
  6303.             given by {address}.
  6304.  
  6305.  
  6306. 13. Visual mode                        *Visual_mode*
  6307. ===============
  6308.  
  6309. Visual mode is a flexible and easy way to select a piece of text for an
  6310. operator.  It is the only way to select a block of text.  {Vi has no Visual
  6311. mode, the name "visual" is used for Normal mode, to distinguish it from Ex
  6312. mode}
  6313.  
  6314.                             *v*
  6315. v            start Visual mode per character.  {not in Vi}
  6316.  
  6317.                             *V*
  6318. V            start Visual mode linewise.  {not in Vi}
  6319.  
  6320.                             *CTRL-V*
  6321. CTRL-V            start Visual mode blockwise.  {not in Vi}
  6322.  
  6323.                             *v_o*
  6324. o            go to Other end of highlighted text: The current
  6325.             cursor position becomes the start of the highlighted
  6326.             text and the cursor is moved to the Other end of the
  6327.             highlighted text.  {not in Vi}
  6328.  
  6329.                             *gv* *v_gv*
  6330. gv            Start Visual mode with the same area as the previous
  6331.             area and the same mode.  In Visual mode the current and
  6332.             the previous Visual area are exchanged.  {not in Vi}
  6333.  
  6334.                             *<LeftMouse>*
  6335. <LeftMouse>        Set the current cursor position.  If Visual mode is
  6336.             active it is stopped.  Only when 'mouse' option is
  6337.             contains 'n' or 'a'.  If the position is within 'so'
  6338.             lines from the last line on the screen the text is
  6339.             scrolled up.  If the position is within 'so' lines from
  6340.             the first line on the screen the text is scrolled
  6341.             down.  {not in Vi}
  6342.  
  6343.                             *<RightMouse>*
  6344. <RightMouse>        Start Visual mode if it is not active.  The text from
  6345.             the cursor position to the position of the click is
  6346.             highlighted.  If Visual mode was already active move
  6347.             the start or end of the highlighted text, which ever
  6348.             is closest, to the position of the click.  Only when
  6349.             'mouse' option contains 'n' or 'a'.  {not in Vi}
  6350.  
  6351.                             *<LeftRelease>*
  6352. <LeftRelease>        This works like a <LeftMouse>, if it is not a
  6353.             the same position as <LeftMouse>.  In an xterm you
  6354.             won't see the selected area until the button is
  6355.             released.  Only when 'mouse' option contains 'n' or
  6356.             'a'.  {not in Vi}
  6357.  
  6358.  
  6359. To apply an operator on a piece of text:
  6360.     1. mark the start of the text with "v", "V" or CTRL-V
  6361.         The character under the cursor will be used as the start.
  6362.     2. move to the end of the text
  6363.         The text from the start of the Visual mode up to and
  6364.         including the character under the cursor is highlighted.
  6365.     3. hit an operator
  6366.         The highlighted characters will be operated upon.
  6367.  
  6368. The 'highlight' option can be used to set the display mode to use for
  6369. highlighting in Visual mode.
  6370.  
  6371. The highlighted text includes the character under the cursor.  On terminals
  6372. where it is possible to make the cursor invisible the cursor position is
  6373. also highlighted.  On terminals where this is not possible the cursor is
  6374. displayed normally.  If your cursor cannot be made invisible and you want Vim
  6375. to highlight the character under the cursor anyway, you could set the 't_cv'
  6376. and 't_ci' options to something harmless, for example:
  6377.     :set t_cv=^[^[ t_ci=^[^[
  6378.  
  6379. With "v" the text before the start position and after the end position will
  6380. not be highlighted.  However, All uppercase and non-alpha operators, except
  6381. "~", will work on whole lines anyway.  See the list of operators below.
  6382.  
  6383.                             *visual_block*
  6384. With CTRL-V (blockwise Visual mode) the highlighted text will be a rectangle
  6385. between start position and the cursor.  However, some operators work on whole
  6386. lines anyway (see the list below).  The change and substitute operators will
  6387. delete the highlighted text and then start insertion at the top left
  6388. position.
  6389.  
  6390. When the "$" command is used with blockwise Visual mode, the right end of the
  6391. highlighted text will be determined by the longest highlighted line.  This
  6392. stops when a motion command is used that does not move straight up or down.
  6393.  
  6394. If you use <Esc>, click the left mouse button or use any command that
  6395. does a jump to another buffer while in Visual mode, the highlighting stops
  6396. and no text is affected.  Also when you hit "v" in characterwise Visual mode,
  6397. "CTRL-V" in blockwise Visual mode or "V" in linewise Visual mode.  If you hit
  6398. CTRL-Z the highlighting stops and the editor is suspended or a new shell is
  6399. started |CTRL-Z|.
  6400.  
  6401.               new mode after typing:        *v_v* *v_CTRL-V* *v_V*
  6402. old mode             "v"              "CTRL-V"               "V"
  6403.  
  6404. Normal              Visual         blockwise Visual       linewise Visual
  6405. Visual              Normal         blockwise Visual       linewise Visual
  6406. blockwise Visual    Visual         Normal                 linewise Visual
  6407. linewise Visual     Visual         blockwise Visual       Normal
  6408.  
  6409. For moving the end of the block many commands can be used, but you cannot
  6410. use Ex commands, commands that make changes or abandon the file.  Commands
  6411. (starting with) ".pPiIaAO&", CTRL-^, "Z", CTRL-], CTRL-T, CTRL-R, CTRL-I
  6412. and CTRL-O cause a beep and Visual mode continues.
  6413.  
  6414. If Visual mode is not active and the "v", "V" or CTRL-V is preceded with a
  6415. count, the size of the previously highlighted area is used for a start.  You
  6416. can then move the end of the highlighted area and give an operator.  The type
  6417. of the old area is used (character, line or blockwise).
  6418. - Linewise Visual mode: The number of lines is multiplied with the count.
  6419. - Blockwise Visual mode: The number of lines and columns is multiplied with
  6420.   the count.
  6421. - Normal Visual mode within one line: The number of characters is multiplied
  6422.   with the count.
  6423. - Normal Visual mode with several lines: The number of lines is multiplied
  6424.   with the count, in the last line the same number of characters is used as
  6425.   in the last line in the previously highlighted area.
  6426. The start of the text is the Cursor position.  If the "$" command was used as
  6427. one of the last commands to extend the highlighted text, the area will be
  6428. extended to the rightmost column of the longest line.
  6429.  
  6430. If you want to highlight exactly the same area as the last time, you can use
  6431. "gv" |gv| |v_gv|.
  6432.  
  6433. The operators that can be used are:
  6434.     ~    switch case                    |v_tilde|
  6435.     d    delete                        |v_d|
  6436.     c    change                        |v_c|
  6437.     y    yank                        |v_y|
  6438.     >    shift right (1)(*)                |v_>|
  6439.     <    shift left (1)(*)                |v_<|
  6440.     !    filter through external command (1)        |v_!|
  6441.     =    filter through 'equalprg' option command (1)    |v_=|
  6442.     Q    format lines to 'textwidth' length (1)(obsolete)|v_Q|
  6443.     gq    format lines to 'textwidth' length (1)        |v_gq|
  6444.  
  6445. The objects that can be used are:
  6446.     a    word                        |v_a|
  6447.     A    WORD (see |WORD|)                |v_A|
  6448.     s    sentence                    |v_s|
  6449.     p    paragraph                    |v_p|
  6450.     P    block                        |v_P|
  6451.  
  6452. Additionally the following commands can be used:
  6453.     :    start ex command for highlighted lines (1)    |v_:|
  6454.     r    change                        |v_r|
  6455.     C    change (2)                    |v_C|
  6456.     R    change (2)                    |v_R|
  6457.     x    delete                        |v_x|
  6458.     D    delete (2)                    |v_D|
  6459.     X    delete (2)                    |v_X|
  6460.     Y    yank (2)                    |v_Y|
  6461.     J    join (1)                    |v_J|
  6462.     U    make uppercase                    |v_U|
  6463.     u    make lowercase                    |v_u|
  6464.     ^]    find tag                    |v_CTRL-]|
  6465.  
  6466. (1): always whole lines, see |:visual_example|
  6467. (2): whole lines when not using CTRL-V
  6468. (*): in a future a blockwise shift will move the block only, not whole
  6469.      lines.
  6470.  
  6471. Note that the ":vmap" command can be used to specifically map keys in Visual
  6472. mode.
  6473.  
  6474. If you want to give a register name using the """ command, do this just before
  6475. typing the operator character: "v{move around}"xd".
  6476.  
  6477. If you want to give a count to the command, do this just before typing the
  6478. operator character: "v{move around}3>" (move lines 3 indents to the right).
  6479.  
  6480.                             *repeat_Visual*
  6481. When repeating a Visual mode operator, the operator will be applied to the
  6482. same amount of text as the last time:
  6483. - Linewise Visual mode: The same number of lines.
  6484. - Blockwise Visual mode: The same number of lines and columns.
  6485. - Normal Visual mode within one line: The same number of characters.
  6486. - Normal Visual mode with several lines: The same number of lines, in the
  6487.   last line the same number of characters as in the last line the last time.
  6488. The start of the text is the Cursor position.  If the "$" command was used as
  6489. one of the last commands to extend the highlighted text, the repeating will
  6490. be applied up to the rightmost column of the longest line.
  6491.  
  6492.                             *:visual_example*
  6493. Currently the ":" command works on whole lines only.  When you select part of
  6494. a line, doing something like ":!date" will replace the whole line.  If you
  6495. want only part of the line to be replaced you will have to make a mapping for
  6496. it.  In a future release ":" may work on partial lines.
  6497.  
  6498. Here is an example, to replace the selected text with the output of "date":
  6499.  
  6500. :vmap _a <Esc>a<CR><Esc>`\<i<CR><Esc>!!date<CR>kJJ
  6501.  
  6502. (In the <> notation |<>|, when typing it you should type it literally; you
  6503. need to remove the 'B' and '<' flags from 'cpoptions')
  6504.  
  6505. What this does is:
  6506. <Esc>        stop Visual mode
  6507. a<CR><Esc>    break the line after the Visual area
  6508. `\<        jump to the start of the Visual area
  6509. i<CR><Esc>    break the line before the Visual area
  6510. !!date<CR>    filter the Visual text through date
  6511. kJJ        Join the lines again
  6512.  
  6513.  
  6514. 14. Various commands                    *various*
  6515. ====================
  6516.  
  6517.                             *CTRL-L*
  6518. CTRL-L            Clear and redraw the screen.
  6519.  
  6520.                             *N<Del>*
  6521. <Del>            When entering a number: Remove the last digit.
  6522.             Note: if you like to use <BS> for this, add this
  6523.             mapping to your .vimrc:
  6524.                 :map CTRL-V <BS>   CTRL-V <Del>
  6525.             See |:fixdel| if your <Del> key does not do what you
  6526.             want.
  6527.  
  6528. :as[cii]    or                    *ga* *:as* *:ascii*
  6529. ga            Print the ascii value of the character under the
  6530.             cursor in decimal, hexadecimal and octal.  For
  6531.             example, when the cursor is on a 'R':
  6532.                 <R>  82,  Hex 52,  Octal 122
  6533.             When the character is a non-standard ASCII character,
  6534.             but printable according to the 'isprint' option, the
  6535.             non-printable version is also given.  When the
  6536.             character is larger than 127, the <M-x> form is also
  6537.             printed.  For example:
  6538.                 <~A>  <M-^A>  129,  Hex 81,  Octal 201
  6539.                 <p>  <|~>  <M-~>  254,  Hex fe,  Octal 376
  6540.             (where <p> is a special character)
  6541.             The <Nul> character in a file is stored internally as
  6542.             <NL>, but it will be shown as:
  6543.                 <^@>  0,  Hex 00,  Octal 000
  6544.             Mnemonic: Get Ascii value.  {not in Vi}
  6545.  
  6546.                             *:p* *:print*
  6547. :[range]p[rint]        Print [range] lines (default current line).
  6548.  
  6549. :[range]p[rint] {count}
  6550.             Print {count} lines, starting with [range] (default
  6551.             current line |cmdline_ranges|).
  6552.  
  6553.                             *:l* *:list*
  6554. :[range]l[ist] [count]
  6555.             Same as :print, but display unprintable characters
  6556.             with '^'.
  6557.  
  6558.                             *:nu* *:number*
  6559. :[range]nu[mber] [count]
  6560.             Same as :print, but precede each line with its line
  6561.             number.  (See also 'highlight' option).
  6562.  
  6563.                             *:#*
  6564. :[range]# [count]    synonym for :number.
  6565.  
  6566.                             *:=*
  6567. :=            Print the cursor line number.
  6568.  
  6569. :norm[al][!] {commands}                    *:norm* *:normal*
  6570.             Execute Normal mode commands {commands}.  This makes
  6571.             it possible to execute normal mode commands typed on
  6572.             the command line.  {commands} is executed like it is
  6573.             typed.  For undo all commands are undone together.  If
  6574.             the [!] is given, mappings will not be used.  If
  6575.             {commands} does not finish a command, more characters
  6576.             need to be typed.  Mostly useful for autocommands.
  6577.             This command cannot be followed by another command,
  6578.             since any '|' is considered part of the command.
  6579.             {not in vi}
  6580.  
  6581.                             *:sh* *:shell*
  6582. :sh[ell]        Escape to a shell (name from 'shell' option).
  6583.  
  6584.                             *:!cmd* *:!*
  6585. :!{cmd}            Execute {cmd} with the shell.  See also the 'shell'
  6586.             and 'shelltype' option.  Any '!' in {cmd} is replaced
  6587.             with the previous external command (see also
  6588.             'cpoptions').  But not when there is a backslash
  6589.             before the '!', then that backslash is removed.
  6590.             Example: ":!ls" followed by ":!echo ! \! \\!"
  6591.             executes "echo ls ! \!".  Also see |shell_window|.
  6592.  
  6593.                             *:!!*
  6594. :!!            Repeat last ":!{cmd}".
  6595.  
  6596.                             *:ve* *:version*
  6597. :ve[rsion]        Print the version number of the editor.  If the
  6598.             compiler used understands "__DATE__" the compilation
  6599.             date is mentioned.  Otherwise a fixed release-date is
  6600.             shown.  The following lines contain information about
  6601.             which options were defined when Vim was compiled.
  6602.  
  6603. :ve[rsion] {nr}        Set the version number to {nr}.  Used in .vimrc files.
  6604.             When omitted Vim will give a warning message. If {nr}
  6605.             is higher than the current Vim version this will
  6606.             result in an error message.  {not in Vi}
  6607.  
  6608. :if                            *:if* *:endif*
  6609. :endif            Every Ex command in between the ":if" and ":endif" is
  6610.             ignored.  These two commands are just to allow for
  6611.             future expansions in a backwards compatible way.
  6612.             Nesting is allowed.  In Vim version 5 you are expected
  6613.             to be able to do something like
  6614.                 :if version >= "5.0"
  6615.                 :  version-5-specific-command
  6616.                 :endif
  6617.             {not in Vi}
  6618.  
  6619.                             *K*
  6620. K            Run a program to lookup the keyword under the
  6621.             cursor.  The name of the program is given with the
  6622.             'keywordprg' (kp) option (default is "man").  The
  6623.             keyword is formed of letters, numbers and the
  6624.             characters in 'iskeyword'.  The keyword under or
  6625.             right of the cursor is used.  The same can be done
  6626.             with the command
  6627.                 ":!{program} {keyword}".
  6628.             There is an example of a program to use in the tools
  6629.             directory of Vim.  It is called 'ref' and does a
  6630.             simple spelling check.
  6631.             If 'keywordprg' is empty, the ":help" command is used.
  6632.             {not in Vi}
  6633.  
  6634.                             *v_K*
  6635. {Visual}K        Like "K", but use the visually highlighted text for
  6636.             the keyword.  Only works when the highlighted text is
  6637.             not more than one line.  {not in Vi}
  6638.  
  6639. [N]gs                            *gs* *:sl* *:sleep*
  6640. :[N]sl[eep] [N]        Do nothing for [N] seconds.  Can be interrupted with
  6641.             CTRL-C (CTRL-break on MS-DOS).  "gs" stands for "goto
  6642.             sleep".  While sleeping the cursor is positioned in
  6643.             the text (if visible).  {not in Vi}
  6644.  
  6645.  
  6646. 15. Repeating commands                    *repeating*
  6647. ======================
  6648.  
  6649. 15.1 Single repeats                    *single_repeat*
  6650.  
  6651.                             *.*
  6652. .            Repeat last change with count replaced with [count].
  6653.  
  6654. Simple changes can be repeated with the "." command.  Without a count, the
  6655. count of the last change is used.  If you enter a count, it will replace the
  6656. last one.  If the last change included a specification of a numbered register,
  6657. the register number will be incremented.  See the section on undo and redo for
  6658. an example how to use this |undo_redo|.  Note that when repeating a command
  6659. that used a Visual selection, the same SIZE of area is used, see
  6660. |repeat_Visual|.
  6661.  
  6662.                             *@:*
  6663. @:            Repeat last command line [count] times.
  6664.  
  6665.  
  6666. 15.2 Multiple repeats                    *multi_repeat*
  6667.  
  6668.                             *:g* *:global*
  6669. :[range]g[lobal]/{pattern}/[cmd]
  6670.             Execute the Ex command [cmd] (default ":p") on the
  6671.             lines within [range] where {pattern} matches.
  6672.  
  6673. :[range]g[lobal]!/{pattern}/[cmd]
  6674.             Execute the Ex command [cmd] (default ":p") on the
  6675.             lines within [range] where {pattern} does NOT match.
  6676.  
  6677.                             *:v* *:vglobal*
  6678. :[range]v[global]/{pattern}/[cmd]
  6679.             Same as :g!.
  6680.  
  6681. The global commands work by first scanning through the [range] lines and
  6682. marking each line where a match occurs.  In a second scan the [cmd] is
  6683. executed for each marked line with its line number prepended.  If a line is
  6684. changed or deleted its mark disappears.  The default for [range] is the whole
  6685. buffer (1,$).  Use "CTRL-C" to interrupt the command.  If an error message is
  6686. given for a line the global command aborts.
  6687.  
  6688. To repeat a non-Ex command, you will have to put the command in a file and
  6689. use "source!".  For example:
  6690.     :g/pat/so! scriptfile
  6691. Make sure that the scriptfile ends with a whole command, otherwise Vim will
  6692. wait for you to type the rest of the command for each match.  The screen will
  6693. not have been updated, so you don't know what you are doing.
  6694.  
  6695. The undo/redo command will undo/redo the whole global command at once.
  6696. The previous context mark will only be set once (with "''" you go back to
  6697. where the cursor was before the global command).
  6698.  
  6699. The global command sets both the last used search pattern and the last used
  6700. substitute pattern (this is vi compatible).  This makes it easy to globally
  6701. replace a string:
  6702.     :g/pat/s//PAT/g
  6703. This replaces all occurences of "pat" with "PAT".  The same can be done with:
  6704.     :%s/pat/PAT/g
  6705. Which is two characters shorter!
  6706.  
  6707.  
  6708. 15.3 Complex repeats                    *complex_repeat*
  6709.  
  6710.                             *q*
  6711. q<0-9a-zA-Z">        Record typed characters into register <0-9a-zA-Z">
  6712.             (uppercase to append).  The 'q' command is disabled
  6713.             while executing a register.  {Vi: no recording}
  6714.  
  6715. q            Stops recording.  (Implementation note: The 'q' that
  6716.             stops recording is not stored in the register, unless
  6717.             it was the result of a mapping)  {Vi: no recording}
  6718.  
  6719.                             *@*
  6720. @<0-9a-z".>        Execute the contents of register <0-9a-z".> [count]
  6721.             times.  Note that register '%' (name of the current
  6722.             file) cannot be used.  See also |@:|.  {Vi: only named
  6723.             registers}
  6724.  
  6725.                             *@@*
  6726. @@            Repeat the previous @<0-9a-z":> [count] times.
  6727.  
  6728.                             *:@*
  6729. :[addr]@<0-9a-z">    Execute the contents of register <0-9a-z"> as an Ex
  6730.             command.  First set cursor at line [addr] (default is
  6731.             current line).  When the last line in the register does
  6732.             not have a <CR> it will be added automatically when
  6733.             the 'e' flag is present in 'cpoptions'.  {Vi: only in
  6734.             some versions} Future: Will execute the register for
  6735.             each line in the address range.
  6736.  
  6737. :[addr]@:        Repeat last command line [count] times.  First set
  6738.             cursor at line [addr] (default is current line).
  6739.             {Vi: only in some versions}
  6740.  
  6741.                             *:@@*
  6742. :[addr]@@        Repeat the previous :@<0-9a-z">.  First set cursor at
  6743.             line [addr] (default is current line).  {Vi: only in
  6744.             some versions}
  6745.  
  6746.                             *:so* *:source*
  6747. :so[urce] {file}    Read Ex commands from {file}.
  6748.  
  6749. :so[urce]! {file}    Read Vim commands from {file}.  {not in Vi}
  6750.  
  6751. All commands and command sequences can be repeated by putting them in a named
  6752. register and then executing it.  There are two ways to get the commands in the
  6753. register:
  6754. - Use the record command "q".  You type the commands once, and while they are
  6755.   being executed they are stored in a register.  Easy, because you can see
  6756.   what you are doing.  If you make a mistake, 'put' the register into the
  6757.   file, edit the command sequence, and then delete it into the register
  6758.   again.  You can continue recording by appending to the register (use an
  6759.   uppercase letter).
  6760. - Delete or yank the command sequence into the register.
  6761.  
  6762. Often used command sequences can be put under a function key with the ':map'
  6763. command.
  6764.  
  6765. An alternative is to put the commands in a file, and execute them with the
  6766. ':source!' command.  Useful for long command sequences.  Can be combined with
  6767. the ':map' command to put complicated commands under a function key.
  6768.  
  6769. The ':source' command reads Ex commands from a file line by line.  You will
  6770. have to type any needed keyboard input.  The ':source!' command reads from a
  6771. script file character by character, interpreting each character as if you
  6772. typed it.
  6773.  
  6774. Example: When you give the ":!ls" command you are asked to "hit return to
  6775. continue".  If you ':source' a file with the line "!ls" in it, you will have
  6776. to type the return yourself.  But if you ':source!' a file with the line
  6777. ":!ls" in it, the next characters from that file are read until a <CR> is
  6778. found.  You will not have to type <CR> yourself, unless ":!ls" was the last
  6779. line in the file.
  6780.  
  6781. It is possible to put ':source[!]' commands in the script file, so you can
  6782. make a top-down hierarchy of script files.  The ':source' command can be
  6783. nested as deep as the number of files that can be opened at one time (about
  6784. 15).  The ':source!' command can be nested up to 15 levels deep.
  6785.  
  6786. In script files terminal-dependent key codes are represented by
  6787. terminal-independent two character codes.  This means that they can be used
  6788. in the same way on different kinds of terminals.  The first character of a
  6789. key code is 0x80 or 128, shown on the screen as "~@".  The second one can be
  6790. found in the list |key_notation|.  Any of these codes can also be entered
  6791. with CTRL-V followed by the three digit decimal code.  This does NOT work for
  6792. the <t_xx> termcap codes, these can only be used in mappings.
  6793.  
  6794.                             *:source_crnl*
  6795. MS-DOS, Win32 and OS/2: Files that are read with ":source" normally have
  6796. <CR>-<NL> line separators.  These always work.  If you are using a file with
  6797. <NL> line separators (for example, a file made on Unix), this will be
  6798. recognized if you have 'textauto' on and the first line does not end in a
  6799. <CR>.  This fails if the first line has something like ":map <F1> :help^M",
  6800. where "^M" is a <CR>.  If the first line ends in a <CR>, but following ones
  6801. don't, you will get an error message, because the <CR> from the first lines
  6802. will be lost.
  6803.  
  6804.  
  6805. 16. Undo and redo                    *undo_redo*
  6806. =================
  6807.  
  6808. <Undo>        or                    *undo* *<Undo>* *u*
  6809. u            Undo [count] changes.  {Vi: only one level}
  6810.  
  6811.                             *:u* *:undo*
  6812. :u[ndo]            Undo one change.  {Vi: only one level}
  6813.  
  6814.                             *CTRL-R*
  6815. CTRL-R            Redo [count] changes which were undone.  {Vi: redraw
  6816.             screen}
  6817.  
  6818.                             *:red* *:redo*
  6819. :red[o]            Redo one change which was undone.  {Vi: no redo}
  6820.  
  6821.                             *U*
  6822. U            Undo all latest changes on one line.  {Vi: while not
  6823.             moved off of it}
  6824.  
  6825. The last changes are remembered.  You can go back in time with the "u"
  6826. command.  You can then go forward again with the 'CTRL-R' command.  If you
  6827. make a new change after the "u" command, the 'CTRL-R' will not be possible
  6828. anymore.  The number of changes that are remembered is set with the
  6829. 'undolevels' option.  If it is zero, the old fashioned Vi undo is present:
  6830. one level of undo and undo undoes itself.  If it is negative no undo is
  6831. possible.  Use this if you are running out of memory.
  6832.  
  6833. The "U" command is treated by undo/redo just like any other command.  Thus a
  6834. "u" command undos a "U" command and a 'CTRL-R' command redoes it again.  When
  6835. mixing "U", "u" and 'CTRL-R' you will notice that the "U" command will
  6836. restore the situation of a line to before the previous "U" command.  This may
  6837. be confusing.  Try it out to get used to it.
  6838.  
  6839. When all changes have been undone the buffer is not considered to be changed.
  6840. Vim can then be exit with ":q" instead of ":q!".  {this is not in Vi}
  6841.  
  6842. The numbered registers can also be used for undoing deletes.  Each time you
  6843. delete text, it is put into register "1.  The contents of register "1 are
  6844. shifted to "2, etc.  The contents of register "9 are lost.  You can now get
  6845. back the most recent deleted text with the put command: '"1P'.  (also, if the
  6846. deleted text was the result of the last delete or copy operation, 'P' or 'p'
  6847. also works as this puts the contents of the unnamed register).  You can get
  6848. back the text of three deletes ago with '"3P'.
  6849.  
  6850. If you want to get back more than one part of deleted text, you can use a
  6851. special feature of the repeat command ".".  It will increase the number of the
  6852. register used.  So if you first do ""1P", the following "." will result in a
  6853. '"2P'.  Repeating this will result in all numbered registers being inserted.
  6854.  
  6855. Example:    If you deleted text with 'dd....' it can be restored with
  6856.         '"1P....'.
  6857.  
  6858. If you don't know in which register the deleted text is, you can use the
  6859. :display command.  An alternative is to try the first register with '"1P', and
  6860. if it is not what you want do 'u.'.  This will remove the contents of the
  6861. first put, and repeat the put command for the second register.  Repeat the
  6862. 'u.' until you got what you want.
  6863.  
  6864.  
  6865. 17. Key mapping                        *key_mapping*
  6866. ===============
  6867.  
  6868. There are commands to enter new mappings, remove mappings and list mappings:
  6869.  
  6870. :map    {lhs} {rhs}                    *:map*
  6871. :nm[ap] {lhs} {rhs}                    *:nm* *:nmap*
  6872. :vm[ap] {lhs} {rhs}                    *:vm* *:vmap*
  6873. :map!   {lhs} {rhs}                    *:map!*
  6874. :im[ap] {lhs} {rhs}                    *:im* *:imap*
  6875. :cm[ap] {lhs} {rhs}                    *:cm* *:cmap*
  6876.             Map the key sequence {lhs} to {rhs} for the modes
  6877.             where the map command applies.
  6878.  
  6879.  
  6880. :no[remap]  {lhs} {rhs}                    *:no*  *:noremap*
  6881. :nn[oremap] {lhs} {rhs}                    *:nn*  *:nnoremap*
  6882. :vn[oremap] {lhs} {rhs}                    *:vn*  *:vnoremap*
  6883. :no[remap]! {lhs} {rhs}                    *:no!* *:noremap!*
  6884. :ino[remap] {lhs} {rhs}                    *:ino* *:inoremap*
  6885. :cno[remap] {lhs} {rhs}                    *:cno* *:cnoremap*
  6886.             Map the key sequence {lhs} to {rhs} for the modes
  6887.             where the map command applies.  Disallow mapping of
  6888.             {rhs}. {not in Vi}
  6889.  
  6890.  
  6891. :unm[ap]  {lhs}                        *:unm*  *:unmap*
  6892. :nun[map] {lhs}                        *:nun*  *:nunmap*
  6893. :vu[nmap] {lhs}                        *:vu*   *:vunmap*
  6894. :unm[ap]! {lhs}                        *:unm!* *:unmap!*
  6895. :iu[nmap] {lhs}                        *:iu*   *:iunmap*
  6896. :cu[nmap] {lhs}                        *:cu*   *:cunmap*
  6897.             Remove the mapping of {lhs} for the modes where the
  6898.             map command applies.
  6899.  
  6900. :mapc[lear]                        *:mapc*  *:mapclear*
  6901. :nmapc[lear]                        *:nmapc* *:nmapclear*
  6902. :vmapc[lear]                        *:vmapc* *:vmapclear*
  6903. :mapc[lear]!                        *:mapc!* *:mapclear!*
  6904. :imapc[lear]                        *:imapc* *:imapclear*
  6905. :cmapc[lear]                        *:cmapc* *:cmapclear*
  6906.             Remove all mappings for the modes where the map
  6907.             command applies.  {not in Vi}
  6908.  
  6909. :map
  6910. :nm[ap]
  6911. :vm[ap]
  6912. :map!
  6913. :im[ap]
  6914. :cm[ap]
  6915.             List all key mappings for the modes where the map
  6916.             command applies.
  6917.  
  6918. :map    {lhs}                        *:map_l*
  6919. :nm[ap] {lhs}                        *:nmap_l*
  6920. :vm[ap] {lhs}                        *:vmap_l*
  6921. :map!   {lhs}                        *:map_l!*
  6922. :im[ap] {lhs}                        *:imap_l*
  6923. :cm[ap] {lhs}                        *:cmap_l*
  6924.             List the key mappings for the key sequences starting
  6925.             with {lhs} in the modes where the map command applies.
  6926.             {not in Vi}
  6927.  
  6928. These commands are used to map a key or key sequence to a string of
  6929. characters.  You can use this to put command sequences under function keys,
  6930. translate one key into another, etc.  See the "Options" chapter below for how
  6931. to save and restore the current mapping |options|.
  6932.  
  6933. There are four sets of mappings
  6934. - For Insert mode. These are also used in Replace mode.
  6935. - For Command-line mode: When entering a ":" or "/" command.
  6936. - For Normal mode: When typing commands.
  6937. - For Visual mode: When typing commands while the Visual area is highlighted.
  6938.  
  6939. Overview of which map command works in which mode:
  6940.  
  6941.     commands:                      modes:
  6942.                       Normal  Visual  Insert Command-line
  6943. :map   :noremap   :unmap   :mapclear         X       X       .         .
  6944. :nmap  :nnoremap  :nunmap  :nmapclear        X       .       .         .
  6945. :vmap  :vnoremap  :vunmap  :vmapclear        .       X       .         .
  6946. :map!  :noremap!  :unmap!  :mapclear!        .       .       X         X
  6947. :imap  :inoremap  :iunmap  :imapclear        .       .       X         .
  6948. :cmap  :cnoremap  :cunmap  :cmapclear        .       .       .         X
  6949.  
  6950. The original Vi did not have separate mappings for Normal/Visual mode and
  6951. Insert/Command-line mode.  Therefore the ":map" and ":map!" commands enter
  6952. and display mappings for both.  In Vim you can use the ":nmap", "vmap",
  6953. ":cmap" and ":imap" commands to enter mappings for each mode separately.
  6954. When listing mappings the character in column 1 is
  6955.  
  6956.     char        mode
  6957.     <Space>        Normal and Visual
  6958.      n        Normal
  6959.      v        Visual
  6960.      !        Insert and Command-line
  6961.      i        Insert
  6962.      c        Command-line
  6963.  
  6964. Note: When using mappings for Visual mode, you can use the '<' mark, which
  6965. is the start of the last selected Visual area |'<|.
  6966.  
  6967. Everything from the first non-blank after {lhs} up to the end of the line
  6968. (or '|') is considered to be part of {rhs}.  This allows the {rhs} to end
  6969. with a space.
  6970.  
  6971.                             *map_backslash*
  6972. Note that only CTRL-V is mentioned here as a special character for mappings
  6973. and abbreviations.  When 'cpoptions' does not contain 'B', a backslash can
  6974. also be used like CTRL-V.  The <> notation can be fully used then |<>|.  But
  6975. you cannot use "<C-V>" like CTRL-V to escape the special meaning of what
  6976. follows.
  6977.  
  6978.                             *map_space_in_lhs*
  6979. To include a space in {lhs} precede it with a CTRL-V (type two CTRL-Vs for
  6980. each space).
  6981.                             *map_space_in_rhs*
  6982. If you want a {rhs} that starts with a space, precede {rhs} with a single
  6983. CTRL-V (you have to type CTRL-V two times).
  6984.                             *map_empty_rhs*
  6985. You can create an empty {rhs} by typing nothing after a single CTRL-V (you
  6986. have to type CTRL-V two times).  Unfortunately, you cannot do this in a vimrc
  6987. file.
  6988.  
  6989. It is not possible to put a comment after this command, because the '"'
  6990. character is considered to be part of the {rhs}.
  6991.  
  6992.                             *map_bar*
  6993. Since the '|' character is used to separate a map command from the next
  6994. command, you will have to do something special to include  a '|' in {rhs}.
  6995. There are three methods:
  6996.    use       works when                    example
  6997.    <Bar>     '<' is not in 'cpoptions'     :map _l :!ls <Bar> more^M
  6998.    \|        'b' is not in 'cpoptions'     :map _l :!ls \| more^M
  6999.    ^V|       always, in Vim and Vi         :map _l :!ls ^V| more^M
  7000.  
  7001. (here ^V stands for CTRL-V; to get one CTRL-V you have to type it twice; you
  7002. cannot use the <> notation "<C-V>" here).
  7003.  
  7004. All three work when you use the default setting for 'cpoptions'.
  7005.  
  7006. When 'b' is present in 'cpoptions', "\|" will be recognized as a mapping
  7007. ending in a '\' and then another command.  This is Vi compatible, but
  7008. unlogical when compared to other commands.
  7009.  
  7010. To avoid mapping of the characters you type in insert or Command-line mode,
  7011. type a CTRL-V first.  The mapping in Insert mode is disabled if the 'paste'
  7012. option is on.
  7013.  
  7014. Note that when an error is enountered (that causes an error message) the rest
  7015. of the mapping is not executed.  This is Vi-compatible.
  7016.  
  7017. Note that the second character (argument) of the commands @zZtTfF[]rm'`"v
  7018. and CTRL-X is not mapped.  This was done to be able to use all the named
  7019. registers and marks, even when the command with the same name has been
  7020. mapped.
  7021.  
  7022. Some examples (given as you type them; e.g., the "^V" is CTRL-V which you
  7023. type, but will not show up on the screen):
  7024.  
  7025.     :map g /foo^V^Mcwbar^V^[    (replace next "foo" with "bar")
  7026.     :map! qq quadrillion questions
  7027.  
  7028. Vim will compare what you type with the start of a mapped sequence.  If there
  7029. is an incomplete match, it will get more characters until there either is a
  7030. complete match or until there is no match at all.  Example: If you map! "qq",
  7031. the first 'q' will not appear on the screen until you type another
  7032. character.  This is because Vim cannot know if the next character will be a
  7033. 'q' or not.  If the 'timeout' option is on (which is the default) Vim will
  7034. only wait for one second (or as long as specified with the 'timeoutlen'
  7035. option).  After that it assumes that the 'q' is to be interpreted as such.  If
  7036. type slowly, or your system is slow, reset the 'timeout' option.  Then you
  7037. might want to set the 'ttimeout' option.  See the "Options" chapter |options|.
  7038.  
  7039.                         *recursive_mapping*
  7040. If you include the {lhs} in the {rhs} you have a recursive mapping.  When
  7041. {lhs} is typed, it will be replaced with {rhs}.  When the {lhs} which is
  7042. included in {rhs} is encountered it will be replaced with {rhs}, and so on.
  7043. This makes it possible to repeat a command an infinite number of times.  The
  7044. only problem is that the only way to stop this is by causing an error.  The
  7045. macros to solve a maze uses this, look there for an example.  There is one
  7046. exception: If the {rhs} starts with {lhs}, the first character is not mapped
  7047. again (this is Vi compatible).
  7048. For example:
  7049.     :map ab abcd
  7050. will execute the "a" command and insert "bcd" in the text.  The "ab" in the
  7051. {rhs} will not be mapped again.
  7052.  
  7053. If you want to exchange the meaning of two keys you should use the :noremap
  7054. command.  For example:
  7055.     :noremap k j
  7056.     :noremap j k
  7057. This will exchange the cursor up and down commands.
  7058.  
  7059. With the normal :map command, when the 'remap' option is on, mapping takes
  7060. place until the text is found not to be a part of a {lhs}.  For example, if
  7061. you use:
  7062.     :map x y
  7063.     :map y x
  7064. Vim will replace x with y, and then y with x, etc.  When this has happened
  7065. 'maxmapdepth' times (default 1000), Vim will give the error message
  7066. "recursive mapping".
  7067.  
  7068. See the file "index" for keys that are not used and thus can be mapped
  7069. without losing any builtin function.  I suggest you use function keys,
  7070. and meta-keys.  If you are prepared to lose a command that you hardly ever use
  7071. you can make mappings that start with '_' or '-'.  You can also use
  7072. ":help <key>^D" to find out if a key is used for some command.  (<key> is the
  7073. specific key you want to find out about, ^D is CTRL-D).
  7074.  
  7075. If you include an undo command inside a mapped sequence, this will bring the
  7076. text back in the state before executing the macro.  This is compatible with
  7077. the original Vi, as long as there is only one undo command in the mapped
  7078. sequence (having two undo commands in a mapped sequence did not make sense
  7079. in the original Vi, you would get back the text before the first undo).
  7080.  
  7081. There are three ways to map a special key:
  7082. 1. The Vi-compatible method: Map the key code.  Often this is a sequence that
  7083.    starts with <Esc>.  To enter a mapping like this you type ":map " and then
  7084.    you have to type CTRL-V before hitting the function key.  Note that when
  7085.    the key code for the key is in the termcap (the t_ options), it will
  7086.    automatically be translated into the internal code and become the second
  7087.    way of mapping (unless the 'k' flag is included in 'cpoptions').
  7088. 2. The second method is to use the internal code for the function key.  To
  7089.    enter such a mapping type CTRL-K and then hit the function key, or use
  7090.    the form "#1", "#2", .. "#9", "#0", "<Up>", "<S-Down>", "<S-F7>", etc.
  7091.    (see table of keys |key_notation|, all keys from <Up> can be used).  The
  7092.    first ten function keys can be defined in two ways: Just the number, like
  7093.    "#2", and with "<F>", like "<F2>".  Both stand for function key 2.  "#0"
  7094.    refers to function key 10, defined with option 't_f10', which may be
  7095.    function key zero on some keyboards.  The <> form cannot be used when
  7096.    'cpoptions' includes the '<' flag.
  7097. 3. Use the termcap entry, with the form <t_xx>, where "xx" is the name of the
  7098.    termcap entry.  Any string entry can be used.  For example:
  7099.        :map <t_F3> G
  7100.    Maps function key 13 to "G".  This does not work if 'cpoptions' includes
  7101.    the '<' flag.
  7102.  
  7103. The advantage of the second and third method is that the mapping will work on
  7104. different terminals without modification (the function key will be
  7105. translated into the same internal code or the actual key code, no matter what
  7106. terminal you are using.  The termcap must be correct for this to work, and you
  7107. must use the same mappings).
  7108.  
  7109. DETAIL: Vim first checks if a sequence from the keyboard is mapped.  If it
  7110. isn't the terminal key codes are tried (see section 20.2
  7111. |terminal_options|).  If a terminal code is found it is replaced with the
  7112. internal code.  Then the check for a mapping is done again (so you can map an
  7113. internal code to something else).  What is written into the script file
  7114. depends on what is recognized.  If the terminal key code was recognized as a
  7115. mapping the key code itself is written to the script file.  If it was
  7116. recognized as a terminal code the internal code is written to the script
  7117. file.
  7118.  
  7119.  
  7120. 18. Recovery after a crash                *crash_recovery*
  7121. ==========================
  7122.  
  7123. You have spent several hours typing in that text that has to be finished
  7124. next morning, and then disaster strikes: Your computer crashes.
  7125.  
  7126.             DON'T PANIC!
  7127.  
  7128. You can recover most of your changes from the files that Vim uses to store
  7129. the contents of the file.  Mostly you can recover your work with one command:
  7130.     vim -r filename
  7131.  
  7132. 18.1 The swap file                    *swap_file*
  7133.  
  7134. Vim stores the things you changed in a swap file.  Using the original file
  7135. you started from plus the swap file you can mostly recover your work.
  7136.  
  7137. You can see the name of the current swap file being used with the command:
  7138.  
  7139.     :sw[apname]                    *:sw* *:swapname*
  7140.  
  7141. The name of the swap file is normally the same as the file you are editing,
  7142. with the extension ".swp".  On MS-DOS and Win32 machines and when the
  7143. 'shortname' option is on, any '.' in the original file name is replaced with
  7144. '_'.  If this file already exists (e.g., when you are recovering from a crash)
  7145. a warning is given and another extension is used, ".swo", ".swn", etc.  An
  7146. existing file will never be overwritten.  The swap file is deleted as soon as
  7147. Vim stops editing the file.
  7148.  
  7149. Technical: The replacement of '.' with '_' is done to avoid problems with
  7150.        MS-DOS compatible filesystems (e.g., crossdos, multidos).  If Vim
  7151.        is able to detect that the file is on an MS-DOS-like filesystem, a
  7152.        flag is set that has the same effect as the 'shortname' option.
  7153.        This flag is reset when you start editing another file.
  7154.  
  7155.        If the ".swp" filename already exists, the last character is
  7156.        decremented until there is no file with that name or ".swa" is
  7157.        reached.  In the last case, no swap file is created.
  7158.  
  7159. By setting the 'directory' option you can place the swap file in another place
  7160. than where the edited file is.
  7161. Advantages:
  7162. - You will not pollute the directories with ".swp" files.
  7163. - When the 'directory' is on another partition, reduce the risk of damaging
  7164.   the file system where the file is (in a crash).
  7165. Disadvantages:
  7166. - You can get name collisions from files with the same name but in different
  7167.   directories (although Vim tries to avoid that by comparing the path name).
  7168.   This will result in bogus ATTENTION warning messages.
  7169. - When you use your home directory, and somebody else tries to edit the same
  7170.   file, he will not see your swap file and will not get the ATTENTION waring
  7171.   message.
  7172. On the Amiga you can also use a recoverable ram disk, but there is no 100%
  7173. guarantee that this works.  Putting swap files in a normal ram disk (like RAM:
  7174. on the Amiga) or in a place that is cleared when rebooting (like /tmp on Unix)
  7175. makes no sense, you will lose the swap file in a crash.
  7176.  
  7177. If you want to put swap files in a fixed place, put a command resembling the
  7178. following ones in your .vimrc:
  7179.     :set dir=dh2:tmp    (for Amiga)
  7180.     :set dir=~/tmp        (for Unix)
  7181.     :set dir=c:\\tmp    (for MS-DOS and Win32)
  7182. This is also very handy when editing files on floppy.  Of course you will have
  7183. to create that "tmp" directory for this to work!
  7184.  
  7185. When starting to edit a file, Vim checks if a swap file already exists for
  7186. that file.  If there is one, you will get a message indicating that something
  7187. is wrong:
  7188.  
  7189.     ATTENTION
  7190.     Found a swap file by the name "../doc/vim_ref.txt.swp"
  7191.              dated: Thu May 16 11:46:31 1996
  7192.          file name: ~mool/vim/vim/doc/vim_ref.txt
  7193.          host name: Kibaale
  7194.          user name: mool
  7195.         process ID: 211 (still running)
  7196.     While opening file "../doc/vim_ref.txt"
  7197.              dated: Wed May 15 21:38:40 1996
  7198.  
  7199. You are to take one of two actions:
  7200.  
  7201. 1. Quit editing this file, because another edit session is active on this
  7202.    file.  Continuing to edit will result in two versions of the same file.
  7203.    The one that is written last will overwrite the other one, resulting in
  7204.    loss of changes.  The text "(still running)" indicates that the process
  7205.    editing this file runs on the same computer (Unix only).  When working over
  7206.    a network you will not see this message, because the process will be
  7207.    running on another computer.
  7208. 2. Recover a previously crashed edit session.  See below |recovery|.
  7209.  
  7210. Vim cannot always detect that a swap file already exists for a file.  This is
  7211. the case when the other edit session puts the swap files in another
  7212. directory or when the path name for the file is different when editing it on
  7213. different machines.
  7214.  
  7215. The swap file is updated after typing 200 characters or when you have not
  7216. typed anything for four seconds.  This only happens if the buffer was
  7217. changed, not when you only moved around.  The reason why it is not kept up to
  7218. date all the time is that this would slow down normal work too much.  You can
  7219. change the 200 character count with the 'updatecount' option.  You can set
  7220. the time with the 'updatetime' option.  The time is given in milliseconds.
  7221. After writing to the swap file Vim syncs the file to disk.  This takes some
  7222. time, especially on busy Unix systems.  If you don't want this you can set the
  7223. 'swapsync' option to an empty string.  The risk of loosing work becomes bigger
  7224. though.  On some non-Unix systems (MS-DOS, Amiga) the swap file won't be
  7225. written at all.
  7226.  
  7227. If the writing to the swap file is not wanted, it can be switched off by
  7228. setting the 'updatecount' option to 0.  The same is done when starting Vim
  7229. with the "-n" option.  Writing can be switched back on by setting the
  7230. 'updatecount' option to non-zero.  Swap files will be created for all buffers
  7231. when doing this.  But when setting 'updatecount' to zero, the existing swap
  7232. files will not be removed, it will only affect files that will be opened
  7233. after this.
  7234.  
  7235. If you want to make sure that your changes are in the swap file use this
  7236. command:
  7237.  
  7238.                             *:pre* *:preserve*
  7239. :pre[serve]        Write all text for all buffers into swap file.  The
  7240.             original file is no longer needed for recovery.  {Vi:
  7241.             emergency exit}
  7242.  
  7243. A Vim swap file can be recognized by the first six characters: "b0VIM ".
  7244. After that comes the version number, e.g., "3.0".
  7245.  
  7246.  
  7247. 18.2 Recovery                        *recovery*
  7248.  
  7249. In most cases recovery is quite easy: Start Vim on the same file you were
  7250. editing when the crash happened, with the "-r" option added.  Vim will read
  7251. the ".swp" file and may read bits and pieces of the original file.
  7252.  
  7253. Example:    vim -r vim_ref.txt
  7254.  
  7255. If you were editing without a file name, give an empty string as argument:
  7256.         vim -r ""
  7257.  
  7258. If there are several swap files that look they may be the one you want to
  7259. use, a list is given of these swap files and you are requested to enter the
  7260. number of the one you want to use.  In case you don't know which one to use,
  7261. just try them one by one and check the resulting files if they are what you
  7262. expected.
  7263.  
  7264. If you know which swap file needs to be used, you can recover by giving the
  7265. swap file name.  Vim will then find out the name of the original file from
  7266. the swap file.
  7267.  
  7268. Example:    Vim -r vim_ref.txt.swo
  7269.  
  7270. This is also handy when the swap file is in another directory than expected.
  7271. If this still does not work, see what file names Vim reports and rename the
  7272. files accordingly.  Check the 'directory' option to see where Vim may have
  7273. put the swap file.
  7274.  
  7275. Another way to do recovery is to start Vim and use the ":recover" command.
  7276. This is easy when you start Vim to edit a file and you get the "ATTENTION:
  7277. Found a swap file ..." message.  In this case the single command ":recover"
  7278. will do the work.  You can also give the name of the file or the swap file to
  7279. the recover command:
  7280.                             *:rec* *:recover*
  7281. :rec[over] [file]    Try to recover [file] from the swap file.  If [file]
  7282.             is not given use the file name for the current
  7283.             buffer.  The current contents of the buffer are lost.
  7284.             This command fails if the buffer was modified.
  7285.  
  7286. :rec[over]! [file]    Like ":recover", but any changes in the current
  7287.             buffer are lost.
  7288.  
  7289. Vim has some intelligence about what to do if the swap file is corrupt in
  7290. some way.  If Vim has doubt about what it found, it will give an error
  7291. message and insert lines with "???" in the text.  If you see an error message
  7292. while recovering, search in the file for "???" to see what is wrong.  You may
  7293. want to cut and paste to get the text you need.
  7294.  
  7295. Be sure that the recovery was successful before overwriting the original
  7296. file or deleting the swap file.  It is good practice to write the recovered
  7297. file elsewhere and run 'diff' to find out if the changes you want are in the
  7298. recovered file.
  7299.  
  7300. Once you are sure the recovery is ok delete the swap file.  Otherwise, you
  7301. will continue to get warning messages that the ".swp" file already exists.
  7302.  
  7303. {Vi: recovers in another way and sends mail if there is something to recover}
  7304.  
  7305.  
  7306. 19. Options                        *options*
  7307. ===========
  7308.  
  7309. Vi has a number of internal variables and switches which can be set to
  7310. achieve special effects.  These options come in three forms:
  7311.     toggle        can only be on or off        *toggle*
  7312.     number        has a numeric value
  7313.     string        has a string value
  7314.  
  7315. 19.1 Setting options                    *set_option*
  7316.  
  7317.                             *:se* *:set*
  7318. :se[t]            Show all options that differ from their default value.
  7319.  
  7320. :se[t] all        Show all but terminal options.
  7321.  
  7322. :se[t] termcap        Show all terminal options.
  7323.  
  7324. :se[t] {option}?    Show value of {option}.
  7325.  
  7326. :se[t] {option}        Toggle option: set, switch it on.
  7327.             Number option: show value.
  7328.             String option: show value.
  7329.  
  7330. :se[t] no{option}    Toggle option: Reset, switch it off.
  7331.  
  7332. :se[t] {option}!   or
  7333. :se[t] inv{option}    Toggle option: Invert value.  {not in Vi}
  7334.  
  7335. :se[t] {option}&    Reset option to its default value.  {not in Vi}
  7336.  
  7337. :se[t] {option}={value}        or
  7338. :se[t] {option}:{value}
  7339.             Set string or number option to {value}.  For numeric
  7340.             options the value can be given in decimal, hex
  7341.             (preceded with 0x) or octal (preceded with '0')
  7342.             (hex and octal are only available for machines which
  7343.             have the strtol() function).  The old value can be
  7344.             inserted by typing <Tab> (or whatever the value of
  7345.             'wildchar' is).  See 4.4.2 |cmdline_completion|.
  7346.             See |option_backslash| for using backslashes in
  7347.             {value}.
  7348.  
  7349.                             *:fix* *:fixdel*
  7350. :fix[del]        Set the value of 't_kD':
  7351.                 't_kb' is     't_kD' becomes
  7352.                   CTRL-?    CTRL-H
  7353.                 not CTRL-?    CTRL-?
  7354.  
  7355.             (CTRL-? is 0177 octal, 0x7f hex) {not in Vi}
  7356.  
  7357.             If your delete key terminal code is wrong, but the
  7358.             code for backspace is allright, you can put this in
  7359.             your .vimrc:
  7360.                 :fixdel
  7361.             This works no matter what the actual code for
  7362.             backspace is.
  7363.  
  7364.             If the backspace key terminal code is
  7365.             wrong you can use this:
  7366.                 :set t_kb=^V<BS>
  7367.                 :fixdel
  7368.             Where "^V" is CTRL-V and "<BS>" is the backspace
  7369.             key.  This will only work for terminals with the same
  7370.             code for the backspace key, you cannot use this in
  7371.             your .vimrc unless the code for backspace is the same
  7372.             on all your systems.
  7373.  
  7374.             If your <Delete> key sends a strange key sequence (not
  7375.             CTRL-? or CTRL-H) you cannot use ":fixdel".  Then use:
  7376.                 :set t_kD=^V<Delete>
  7377.             Where "^V" is CTRL-V and "<Delete>" is the delete key.
  7378.             This will only work on systems with the same terminal
  7379.             codes for delete.
  7380.  
  7381.             Note about Linux: By default the backspace key
  7382.             produces CTRL-?, which is wrong.  You can fix it by
  7383.             putting this line in your rc.local:
  7384.                 echo "keycode 14 = BackSpace" | loadkeys
  7385.  
  7386. The {option} arguments to ":set" may be repeated.  For example:
  7387.     ":set ai nosi sw=3 ts=3".
  7388. If you make an error in one of the arguments an error message will be given
  7389. and the text up to the next space will be skipped.  Thus following arguments
  7390. will be processed.
  7391.  
  7392. For {option} the form "t_xx" may be used to set a termcap option.  This will
  7393. override the value from the termcap.  You can then use it in a mapping.  If
  7394. the "xx" part contains special characters, use the <t_xx> form:
  7395.     :set <t_#4>=^[Ot
  7396.  
  7397. The listing from ":set" looks different from Vi.  Long string options are put
  7398. at the end of the list.  The number of options is quite large.  The output of
  7399. "set all" probably does not fit on the screen, causing Vim to give the
  7400. "--more--" message.  See the 'more' option.
  7401.  
  7402.                             *:set_env*
  7403. Environment variables in most string options will be expanded.  If the
  7404. environment variable exists the '$' and the following environment variable
  7405. name is replaced with its value.  If it does not exist the '$' and the name
  7406. are not modified.  Any non-id character (not a letter, digit or '_') may
  7407. follow the environment variable name.  That character and what follows is
  7408. appended to the value of the environment variable.  Examples:
  7409.     :set term=$TERM.new
  7410.     :set path=/usr/$INCLUDE,$HOME/include,.
  7411.  
  7412. Using "~" is like using "$HOME", but it is only recognized at the start of an
  7413. option and after a space or comma.
  7414.  
  7415.                             *option_backslash*
  7416. To include white space in a string option value it has to be preceded with a
  7417. backslash.  To include a backslash you have to use two.  Effectively this
  7418. means that the number of backslashes in an option value is halved (rounded
  7419. down).
  7420. A few examples:
  7421.     :set tags=tags\ /usr/tags     results in "tags /usr/tags"
  7422.     :set tags=tags\\,file        results in "tags\,file"
  7423.     :set tags=tags\\\ file        results in "tags\ file"
  7424.  
  7425. For MS-DOS and WIN32 backslashes in file names are mostly not removed.  More
  7426. precise: For options that expect a file name (those where environment
  7427. variables are expanded) a backslash before a normal file name character is not
  7428. removed.  But a backslash before a special character (space, backslash, comma,
  7429. etc.) is used like explained above.
  7430.  
  7431.  
  7432. 19.2 Automatically setting options            *auto_setting*
  7433.  
  7434. Besides changing options with the ":set" command, there are three alternatives
  7435. to set options automatically for one or more files:
  7436.  
  7437. 1. When starting Vim initializations are read from various places.  See
  7438.    |initialization|.  Most of them are performed for all editing sessions,
  7439.    and some of them depend on the directory where Vim is started.
  7440. 2. If you start editing a new file, the automatic commands are executed.
  7441.    This can be used to set options for files matching a particular pattern and
  7442.    many other things.  See the section "Automatic commands" |autocommand|.
  7443. 3. If you start editing a new file, and the 'modeline' option is on, a
  7444.    number of lines at the beginning and end of the file are checked for
  7445.    modelines.  This is explained here.
  7446.  
  7447.                             *modeline*
  7448. There are two forms of modelines.  The first form:
  7449.     [text]{white}{vi:|vim:|ex:}[white]{options}
  7450.  
  7451. [text]        any text or empty
  7452. {white}        at least one white space (<Space> or <Tab>)
  7453. {vi:|vim:|ex:}    the string "vi:", "vim:" or "ex:"
  7454. [white]        optional white space
  7455. {options}    a list of option settings, separated with white space or ':',
  7456.         where each part between ':' is the argument for a ":set"
  7457.         command
  7458.  
  7459. Example:
  7460.     " vi:noai:sw=3 ts=6"
  7461.  
  7462. The second form (this is compatible with some versions of Vi):
  7463.  
  7464.     [text]{white}{vi:|vim:|ex:}[white]set {options}:[text]
  7465.  
  7466. [text]        any text or empty
  7467. {white}        at least one white space (<Space> or <Tab>)
  7468. {vi:|vim:|ex:}    the string "vi:", "vim:" or "ex:"
  7469. [white]        optional white space
  7470. set         the string "set " (note the space)
  7471. {options}    a list of options, separated with white space, which is the
  7472.         argument for a ":set" command
  7473. :        a colon
  7474. [text]        any text or empty
  7475.  
  7476. Example:
  7477.     "/* vim: set ai tw=75: */"
  7478.  
  7479. The white space before {vi:|vim:|ex:} is required.  This minimizes the chance
  7480. that a normal word like "lex:" is caught.  There is one exception: "vi:" and
  7481. "vim:" can also be at the start of the line (for compatibility with version
  7482. 3.0).  Using "ex:" at the start of the line will be ignored (this could be
  7483. short for "example:").
  7484.  
  7485. The number of lines that are checked can be set with the 'modelines' option.
  7486. If 'modeline' is off or 'modelines' is 0 no lines are checked.
  7487.  
  7488. Note that for the first form all of the rest of the line is used, thus a line
  7489. like:
  7490.     "/* vi:ts=4: */"
  7491. will give an error message for the trailing "*/".  This line is OK:
  7492.     "/* vi:set ts=4: */"
  7493.  
  7494. If an error is detected the rest of the line is skipped.
  7495.  
  7496. If you want to include a ':' in a set command precede it with a '\'.  No other
  7497. commands than "set" are supported, for security reasons (somebody might create
  7498. a trojan horse text file with modelines).
  7499.  
  7500.  
  7501. 19.3 Saving settings                    *save_settings*
  7502.  
  7503.                             *:mk* *:mkexrc*
  7504. :mk[exrc] [file]    Write current key mappings and changed options to
  7505.             [file] (default ".exrc" in the current directory),
  7506.             unless it already exists.  {not in Vi}
  7507.  
  7508. :mk[exrc]! [file]    Always write current key mappings and changed
  7509.             options to [file] (default ".exrc" in the current
  7510.             directory).  {not in Vi}
  7511.  
  7512.                             *:mkv* *:mkvimrc*
  7513. :mkv[imrc][!] [file]    Like as :mkexrc, but default is ".vimrc" in the
  7514.             current directory.  The ":version" command is also
  7515.             written to the file.  {not in Vi}
  7516.  
  7517. These commands will write ":map" and ":set" commands to a file, in such a way
  7518. that when these commands are executed, the current key mappings and options
  7519. will be set to the same values.  The options 'columns', 'endofline', 'lines',
  7520. 'modified', 'scroll', 'term' and 'ttyfast' are not included, because these are
  7521. terminal or file dependent.  Note that the options 'binary', 'textmode',
  7522. 'paste' and 'readonly' are included, this might not always be what you want.
  7523.  
  7524. A common method is to use a default ".vimrc" file, make some modifications
  7525. with ":map" and ":set" commands and write the modified file.  First read the
  7526. default ".vimrc" in with a command like ":source ~piet/.vimrc.Cprogs", change
  7527. the settings and then save them in the current directory with ":mkvimrc!".  If
  7528. you want to make this file your default .vimrc, move it to your home directory
  7529. (on Unix), s: (Amiga) or $VIM directory (MS-DOS).  You could also use
  7530. autocommands |autocommand| and/or modelines |modeline|.
  7531.  
  7532.  
  7533. 19.4 Options summary                *option_summary*
  7534.  
  7535. In the list below all the options are mentioned with their full name and some
  7536. with an abbreviation between parens.  Both forms may be used.  In this
  7537. document when an option that can be toggled is "set" that means that ":set
  7538. option" is entered.  When an option is "reset", ":set nooption" is used.
  7539.  
  7540. Most options are the same in all windows and buffers.  There are a few that
  7541. are specific to how the text is presented in a window.  These can be set to a
  7542. different value in each window.  For example the 'list' option can be set in
  7543. one window and reset in another for the same text, giving both types of view
  7544. at the same time.  There are a few options that are specific to a certain
  7545. file.  These can have a different value for each file or buffer.  For example
  7546. the 'textwith' option can be 78 for a normal text file and 0 for a C
  7547. program.
  7548.  
  7549.     global            one option for all buffers and windows
  7550.     local to window        each window has its own copy of this option
  7551.     local to buffer        each buffer has its own copy of this option
  7552.  
  7553. When creating a new window the option values from the currently active window
  7554. are used as a default value for the window-specific options.  For the
  7555. buffer-specific options this depends on the 's' and 'S' flags in the
  7556. 'cpoptions' option.  If 's' in included (which is the default) the values for
  7557. buffer options are copied from the currently active buffer when a buffer is
  7558. first entered.  If 'S' is present the options are copied each time the buffer
  7559. is entered, this is almost like having global options.  If 's' and 'S' are not
  7560. present, the options are copied from the currently active buffer when the
  7561. buffer is created.
  7562.  
  7563. A jump table for the options with a short description can be found at |X_op|.
  7564.  
  7565.                     *'aleph'* *'al'*
  7566. aleph (al)        number  (default 128 for MS-DOS, 224 otherwise)
  7567.             global
  7568.             {not in Vi}
  7569.             {This option applies only if Vim was compiled with
  7570.             RIGHTLEFT defined}
  7571.     The ASCII code for the first letter of the Hebrew alphabet.  The
  7572.     routine that maps the keyboard in Hebrew mode, both in Insert mode
  7573.     (when hkmap is set) and on the command line (when hitting CTRL-_)
  7574.     outputs the Hebrew characters in the range [aleph..aleph+26].
  7575.     aleph=128 applies to PC code, and aleph=224 applies to ISO 8859-8.
  7576.     See |vim_rlh.txt|.
  7577.  
  7578.                    *'autoindent'* *'ai'* *'noautoindent'* *'noai'*
  7579. autoindent (ai)        toggle    (default off)
  7580.             local to buffer
  7581.     Copy indent from current line when starting a new line (typing <CR>
  7582.     in Insert mode or when using the "o" or "O" command).  If you do not
  7583.     type anything on the new line except <BS> and then type <Esc> or
  7584.     <CR>, the indent is deleted again.  When autoindent is on,
  7585.     formatting (with the "gq" command or when you reach 'textwidth' in
  7586.     Insert mode) uses the indentation of the first line.   When
  7587.     'smartindent' or 'cindent' is on the indent is changed in specific
  7588.     cases.  The 'autoindent' option is reset when the 'paste' option is
  7589.     set.  {small difference from Vi: After the indent is deleted when
  7590.     typing <Esc> or <CR>, the cursor position when moving up or down is
  7591.     after the deleted indent; Vi puts the cursor somewhere in the deleted
  7592.     indent}.
  7593.  
  7594.                  *'autowrite'* *'aw'* *'noautowrite'* *'noaw'*
  7595. autowrite (aw)        toggle    (default off)
  7596.             global
  7597.     Write the contents of the file, if it has been modified, on each
  7598.     :next, :rewind, :previous, :stop, :suspend, :tag, :!, :make, CTRL-]
  7599.     and CTRL-^ command; and when a CTRL-O, CTRL-I, '<A-Z0-9>, or `<A-Z0-9>
  7600.     command takes one to another file.
  7601.  
  7602.                     *'backspace'* *'bs'*
  7603. backspace (bs)        number    (default 0)
  7604.             global
  7605.             {not in Vi}
  7606.     Influences the working of <BS>, <Del>, CTRL-W and CTRL-U in Insert
  7607.     mode.  If set to 0 Vi compatible backspacing is used.  When 1 allow
  7608.     backspacing over newlines.  When larger than 1 allow backspacing over
  7609.     the start of insert.  In the last case CTRL-W and CTRL-U stop once at
  7610.     the start of insert.  See |:fixdel| if your <BS> or <Del> key does not
  7611.     do what you want.
  7612.  
  7613.                        *'backup'* *'bk'* *'nobackup'* *'nobk'*
  7614. backup (bk)        toggle    (default off)
  7615.             global
  7616.             {not in Vi}
  7617.     Make a backup before overwriting a file.  Leave it around after the
  7618.     file has been successfully written.  If you do not want to keep the
  7619.     backup file, but you do want a backup while the file is being
  7620.     written, reset this option and set the 'writebackup' option (this is
  7621.     the default).  If you do not want a backup file at all reset both
  7622.     options (use this if your file system is almost full).  See the table
  7623.     in section 5.4 for more explanations |backup_table|.
  7624.  
  7625.                         *'backupdir'* *'bdir'*
  7626. backupdir (bdir)    string    (default for Amiga: ".,t:",
  7627.                  for MS-DOS and Win32: ".,c:/tmp,c:/temp"
  7628.                  for Unix: ".,~/tmp,~/")
  7629.             global
  7630.             {not in Vi}
  7631.     List of directories for the backup file, separated with commas.
  7632.     - The backup file will be created in the first directory in the list
  7633.       where this is possible.
  7634.     - Empty means that no backup file will be created ('patchmode' is
  7635.       impossible!).
  7636.     - A directory "." means to put the backup file in the same directory
  7637.       as the edited file.
  7638.     - A directory starting with "./" (or ".\" for MS-DOS et.al.) means to
  7639.       put the backup file relative to where the edited file is.  The
  7640.       leading "." is replaced with the path name of the edited file.
  7641.     - Spaces after the comma are ignored, other spaces are considered part
  7642.       of the directory name.  To have a space at the start of a directory
  7643.       name, precede it with a backslash.
  7644.     - To include a comma in a directory name precede it with a backslash.
  7645.     - A directory name may end in an '/'.
  7646.     - Environment variables are expanded |:set_env|.
  7647.     - Careful with '\' characters, type one before a space, type two to
  7648.       get one in the option (see |option_backslash|), for example:
  7649.         :set bdir=c:\\tmp,\ dir\\,with\\,commas,\\\ dir\ with\ spaces
  7650.     - For backwards compatibility with Vim version 3.0 a '>' at the start
  7651.       of the option is removed.
  7652.     See also 'backup' and 'writebackup' options.
  7653.  
  7654.                         *'backupext'* *'bex'*
  7655. backupext (bex)        string    (default "~")
  7656.             global
  7657.             {not in Vi}
  7658.     String which is appended to a file name to make the name of the
  7659.     backup file.  The default is quite unusual, because this avoids
  7660.     accidently overwriting existing files with a backup file.  You might
  7661.     prefer using ".bak", but make sure that you don't have files with
  7662.     ".bak" that you want to keep.
  7663.  
  7664.                      *'binary'* *'bin'* *'nobinary'* *'nobin'*
  7665. binary (bin)        toggle    (default off)
  7666.             local to buffer
  7667.             {not in Vi}
  7668.     This option should be set before editing a binary file.  You can also
  7669.     use the "-b" Vim argument.  When this option is switched on a few
  7670.     options will be changed (also when it already was on):
  7671.         'textwidth'  will be set to 0
  7672.         'wrapmargin' will be set to 0
  7673.         'modeline'   will be off
  7674.         'textmode'   will be off
  7675.         'textauto'   will be off
  7676.         'expandtab'  will be off
  7677.     NOTE: When you start editing a(nother) file while the 'bin' option is
  7678.     on, settings from the modelines or autocommands may change the
  7679.     settings again (e.g., 'textwidth'), causing trouble when editing.  You
  7680.     might want to set 'bin' again when the file has been loaded.
  7681.     The previous values of these options are remembered and restored when
  7682.     'bin' is switched fron on to off.  Each buffer has its own set of
  7683.     saved option values, except for 'textauto', which is global.
  7684.     When writing a file the end-of-line for the last line is only written
  7685.     if there was one in the original file (normally Vim appends an
  7686.     end-of-line to the last line if there is none; this would make the
  7687.     file longer).  See the 'endofline' option.
  7688.  
  7689.                    *'bioskey'* *'biosk'* *'nobioskey'* *'nobiosk'*
  7690. bioskey (biosk)        toggle    (default on)
  7691.             global
  7692.             {not in Vi}  {Only for MS-DOS}
  7693.     When on the bios is called to obtain a keyboard character.  This works
  7694.     better to detect CTRL-C, but only works for the console.  When using a
  7695.     terminal over a serial port reset this option.
  7696.  
  7697.                         *'breakat'* *'brk'*
  7698. breakat (brk)        string    (default " ^I!@*-+_;:,./?")
  7699.             global
  7700.             {not in Vi}
  7701.     This option lets you choose which characters might cause a line
  7702.     break if 'linebreak' is on.
  7703.  
  7704.                    *'cindent'* *'cin'* *'nocindent'* *'nocin'*
  7705. cindent (cin)        toggle    (default off)
  7706.             local to buffer
  7707.             {not in Vi}
  7708.             {Only present when compiled with CINDENT enabled,
  7709.             ":version" says "+cindent" instead of "-cindent"}
  7710.     Enables automatic C program indenting  See 'cinkeys' to set the keys
  7711.     that trigger reindenting in insert mode and 'cinoptions' to set your
  7712.     preferred indent style.  If 'lisp' is not on and 'equalprg' is empty,
  7713.     the "=" operator indents using this algorithm rather than calling an
  7714.     external program.  See |C_indenting|.  This option is switched off
  7715.     when 'paste' is set.  When you don't like the way 'cindent' works, try
  7716.     the 'smartindent' option.
  7717.  
  7718. cinkeys (cink)        string    (default "0{,0},:,0#,!^F,o,O,e")
  7719.             local to buffer
  7720.             {not in Vi}
  7721.             {Only present when compiled with CINDENT enabled}
  7722.     A list of keys that, when typed in insert mode, cause reindenting of
  7723.     the current line.  Only happens if 'cindent' is on.  See
  7724.     |C_indenting|.
  7725.  
  7726.                         *'cinoptions'* *'cino'*
  7727. cinoptions (cino)    string    (default "")
  7728.             local to buffer
  7729.             {not in Vi}
  7730.             {Only present when compiled with CINDENT enabled}
  7731.     The 'cinoptions' affect the way 'cindent' reindents lines in a C
  7732.     program.  See |C_indenting|.
  7733.  
  7734.                         *'cinwords'* *'cinw'*
  7735. cinwords (cinw)        string    (default "if,else,while,do,for,switch")
  7736.             local to buffer
  7737.             {not in Vi}
  7738.             {Only present when compiled with CINDENT or
  7739.             SMARTINDENT enabled}
  7740.     These keywords start an extra indent in the next line when
  7741.     'smartindent' or 'cindent' is set.  For 'cindent' this is only done at
  7742.     an appropriate place (inside {}).
  7743.  
  7744.                         *'cmdheight'* *'ch'*
  7745. cmdheight (ch)        number    (default 1)
  7746.             global
  7747.             {not in Vi}
  7748.     Number of lines to use for the command line.  If you are annoyed by
  7749.     "Hit return ..." caused by long messages, set this option to a larger
  7750.     value.
  7751.  
  7752.                         *'columns'* *'co'*
  7753. columns (co)        number    (default 80 or terminal width)
  7754.             global
  7755.             {not in Vi}
  7756.     Number of columns of the screen.  Normally this is set by the terminal
  7757.     initialization and does not have to be set by hand.
  7758.  
  7759.                         *'comments'* *'com'*
  7760. comments (com)        string    (default
  7761.                 "sr:/*,mb:*,el:*/,://,b:#,:%,:XCOMM,n:>,fb:-")
  7762.             local to buffer
  7763.             {not in Vi}
  7764.     A comma separated list of patterns that can start a comment line.  See
  7765.     |format_comments|.  See |option_backslash| about using backslashes to
  7766.     insert a space.
  7767.  
  7768.                    *'compatible'* *'cp'* *'nocompatible'* *'nocp'*
  7769. compatible (cp)        toggle    (default off, on when compiled with COMPATIBLE
  7770.                 defined, ":version" shows "+compatible")
  7771.             global
  7772.             {not in Vi}
  7773.     At the moment this option is set, several other options will be set
  7774.     or reset to make Vim Vi-compatible.  Switching this option off has no
  7775.     effect.  See also 'cpoptions'.
  7776.  
  7777.     option        new value    effect
  7778.  
  7779.     backspace    0        normal backspace
  7780.     backup        off        no backup file
  7781.     cindent        off        no C code indentation
  7782.     cpoptions    "bBcefFkmorsStwx$!%<"    vi-compatible flags
  7783.     digraph        off        no digraphs
  7784.     esckeys        off        no <Esc>-keys in Insert mode
  7785.     expandtab    off        tabs not expanded to spaces
  7786.     formatoptions    "vt"        Vi compatible formatting
  7787.     gdefault    off        no default 'g' flag for ":s"
  7788.     history        0        no commandline history
  7789.     insertmode    off        do not start in Insert mode
  7790.     iskeyword    "@,48-57,_"    keywords contain alphanumeric
  7791.                         characters and '_'
  7792.     joinspaces    on        insert 2 spaces after period
  7793.     modeline    off        no modelines
  7794.     more        off        no pauses in listings
  7795.     revins        off        no reverse insert
  7796.     ruler        off        no ruler
  7797.     scrolljump    1        no jump scroll
  7798.     scrolloff    0        no scroll offset
  7799.     shiftround    off        indent not rounded to shiftwidth
  7800.     showcmd        off        command characters not shown
  7801.     showmode    off        current mode not shown
  7802.     smartcase    off        no automatic ignore case switch
  7803.     smartindent    off        no smart indentation
  7804.     smarttab    off        no smart tab size
  7805.     startofline    on        goto startofline with some commands
  7806.     textauto    off        no automatic textmode detection
  7807.     textwidth    0        no automatic line wrap
  7808.     tildeop        off        tilde is not an operator
  7809.     ttimeout    off        no terminal timeout
  7810.     undolevels    0        no multilevel undo
  7811.     updatecount    0        no swap file
  7812.     whichwrap    ""        left-right movements don't wrap
  7813.     wildchar    CTRL-E        only when the current value is <Tab>
  7814.                     use CTRL-E for cmdline completion
  7815.     writebackup    off        no backup file written
  7816.  
  7817.                         *'cpoptions'* *'cpo'*
  7818. cpoptions (cpo)        string    (default "BceFs", unless compiled with
  7819.                 COMPATIBLE defined, then all flags are
  7820.                 included)
  7821.             global
  7822.             {not in Vi}
  7823.     Sequence of characters.  When a character is present this indicates
  7824.     vi-compatible behaviour.  This is used for things where not being
  7825.     vi-compatible is mostly or sometimes preferred.  'cpoptions' stands
  7826.     for 'compatibleoptions'.  Commas can be added for readability.
  7827.  
  7828.         contains    behaviour
  7829.         b    "\|" in a ":map" command is recognized as the end of
  7830.             the map command.  The '\' is included in the mapping,
  7831.             the text after the '|' is interpreted as the next
  7832.             command.  Use a CTRL-V instead of a backslash to
  7833.             include the '|' in the mapping.  Applies to all
  7834.             mapping, abbreviation, menu and autocmd commands.
  7835.             See also |map_bar|.
  7836.         B    A backslash has no special meaning in mappings,
  7837.             abbreviations and the "to" part of the menu commands.
  7838.             Remove this flag to be able to use a backslash like a
  7839.             CTRL-V.  This flag must be removed to be able to fully
  7840.             use the <> notation.  For example, the command
  7841.             ":map X \<Esc>" results in X being mapped to:
  7842.                 'B' included:    "\^["    (^[ is a real <Esc>)
  7843.                 'B' excluded:   "<Esc>"  (5 characters)
  7844.                 ('<' excluded in both cases)
  7845.         <    Disable the recognition of special key codes in <>
  7846.             form in mappings, abbreviations, and the "to" part of
  7847.             menu commands.  For example, the command
  7848.             ":map X <Tab>" results in X being mapped to:
  7849.                 '<' included:   "<Tab>"  (5 characters)
  7850.                 '<' excluded:   "^I"     (^I is a real <Tab>)
  7851.             Also see the 'k' flag below.
  7852.         c    Searching continues at the end of any match at the
  7853.             cursor position.  When not present searching continues
  7854.             one character from the cursor position.  With 'c'
  7855.             "abababababab" only gets three matches when repeating
  7856.             "/abab", without 'c' there are five matches.
  7857.         e    When executing a register with ":@r", always add a
  7858.             <CR> to the last line, also when the register is not
  7859.             linewise.  If this flag is not present, the register
  7860.             is not linewise and the last line does not end in a
  7861.             <CR>, then the last line is put on the command line
  7862.             and can be edited before hitting <CR>.
  7863.         f    When included, a ":read" command with a file name
  7864.             argument will set the file name for the current buffer,
  7865.             if the current buffer doesn't have a file name yet.
  7866.         F    When included, a ":write" command with a file name
  7867.             argument will set the file name for the current buffer,
  7868.             if the current buffer doesn't have a file name yet.
  7869.         k    Disable the recognition of raw key codes in
  7870.             mappings, abbreviations, and the "to" part of menu
  7871.             commands.  For example, if <Key> sends ^[OA (where ^[
  7872.             is <Esc>), the command ":map X ^[OA" results in X
  7873.             being mapped to:
  7874.                 'k' included:   "^[OA"   (3 characters)
  7875.                 'k' excluded:   "<Key>"  (one key code)
  7876.             Also see the '<' flag above.
  7877.         m    When included, a showmatch will always wait half a
  7878.             second.  When not included, a showmatch will wait half
  7879.             a second or until a character is typed.  |'showmatch'|
  7880.         o    Line offset to search command is not remembered for
  7881.             next search.
  7882.         r    Redo ("." command) uses "/" to repeat a search
  7883.             command, instead of the actually used search string.
  7884.         s    Set buffer options when entering the buffer for the
  7885.             first time.  This is like it is in Vim version 3.0.
  7886.             And it is the default.  If not present the options are
  7887.             set when the buffer is created.
  7888.         S    Set buffer options always when entering a buffer
  7889.             (except 'readonly' and 'textmode').  This is the
  7890.             (most) Vi compatible setting.
  7891.             The options are set to the values in the current
  7892.             buffer.  When you change an option and go to another
  7893.             buffer, the value is copied.  Effectively makes the
  7894.             buffer options global to all buffers.
  7895.  
  7896.             's'    'S'     copy buffer options
  7897.             no     no      when buffer created
  7898.             yes    no      when buffer first entered (default)
  7899.              X     yes     each time when buffer entered (vi comp.)
  7900.  
  7901.         t    Search pattern for the tag command is remembered for
  7902.             "n" command.  Otherwise Vim only puts the pattern in
  7903.             the history for search pattern, but doesn't change the
  7904.             last used search pattern.
  7905.         w    When using "cw" on a blank character, only change one
  7906.             character and not all blanks until the start of the
  7907.             next word.
  7908.         x    <Esc> on the command line executes the command line.
  7909.             The default in Vim is to abandon the command line,
  7910.             because <Esc> normally aborts a command.  |c_<Esc>|
  7911.         $    When making a change to one line, don't redisplay the
  7912.             line, but put a '$' at the end of the changed text.
  7913.             The changed text will be overwritten when you type the
  7914.             new text.  The line is redisplayed if you type any
  7915.             command that moves the cursor from the insertion
  7916.             point.
  7917.         !    When redoing a filter command, use the last used
  7918.             external command, whatever it was.  Otherwise the last
  7919.             used -filter- command is used.
  7920.         %    Vi-compatible matching is done for the "%" command.
  7921.             Parens inside single and double quotes are also
  7922.             counted, causing a string that contains a paren to
  7923.             disturb the matching.  For example, in a line like
  7924.             "if (strcmp("foo(", s))" the first paren does not
  7925.             match the last one.  When this flag is not included,
  7926.             parens inside single and double quotes are treated
  7927.             specially.  When matching a paren outside of quotes,
  7928.             everything inside quotes is ignored.  When matching a
  7929.             paren inside quotes, it will find the matching one (if
  7930.             there is one).  This works very well for C programs.
  7931.  
  7932.                         *'define'* *'def'*
  7933. define (def)        string    (default "^#[ \t]*define")
  7934.             global
  7935.             {not in Vi}
  7936.     Pattern to be used to find a macro definition.  It is a search
  7937.     pattern, just like for the "/" command.  The default value is for C
  7938.     programs.  This option is used for the commands like "[i" and "[d"
  7939.     |include_search|.  The 'isident' option is used to recognize the
  7940.     identifier name after the match.  See |option_backslash| about
  7941.     inserting backslashes to include a space or backslash.
  7942.  
  7943.                         *'dictionary'* *'dict'*
  7944. dictionary (dict)    string    (default "")
  7945.             global
  7946.             {not in Vi}
  7947.     List of file names, separated by commas, that are used to lookup words
  7948.     for keyword completion commands |i_CTRL-X_CTRL-K|.  Each file should
  7949.     contain a list of words, one word per line.  To include a comma in a
  7950.     file name precede it with a backslash.  Spaces after a comma are
  7951.     ignored, otherwise spaces are included in the file name.  See
  7952.     |option_backslash| about using backslashes.
  7953.  
  7954.                      *'digraph'* *'dg'* *'nodigraph'* *'nodg'*
  7955. digraph (dg)        toggle    (default off)
  7956.             global
  7957.             {not in Vi}
  7958.             {Only applies when compiled with DIGRAPHS defined,
  7959.             check with ":version"}
  7960.     Enable the entering of digraphs in Insert mode with {char1} <BS>
  7961.     {char2}.  See |digraphs|.
  7962.  
  7963.                         *'directory'* *'dir'*
  7964. directory (dir)        string    (default for Amiga: ".,t:",
  7965.                  for MS-DOS and Win32: ".,c:\tmp,c:\temp"
  7966.                  for Unix: ".,~/tmp,/tmp")
  7967.             global
  7968.     List of directory names for the swap file, separated with commas.
  7969.     - The swap file will be created in the first directory where this is
  7970.       possible.
  7971.     - Empty means that no swap file will be used (recovery is
  7972.       impossible!).
  7973.     - A directory "." means to put the swap file in the same directory as
  7974.       the edited file.
  7975.     - A directory starting with "./" (or ".\" for MS-DOS et.al.) means to
  7976.       put the swap file relative to where the edited file is.  The leading
  7977.       "." is replaced with the path name of the edited file.
  7978.     - Spaces after the comma are ignored, other spaces are considered part
  7979.       of the directory name.  To have a space at the start of a directory
  7980.       name, precede it with a backslash.
  7981.     - To include a comma in a directory name precede it with a backslash.
  7982.     - A directory name may end in an ':' or '/'.
  7983.     - Environment variables are expanded |:set_env|.
  7984.     - Careful with '\' characters, type one before a space, type two to
  7985.       get one in the option (see |option_backslash|), for example:
  7986.         :set dir=c:\\tmp,\ dir\\,with\\,commas,\\\ dir\ with\ spaces
  7987.     - For backwards compatibility with Vim version 3.0 a '>' at the start
  7988.       of the option is removed.
  7989.     Using "." first in the list is recommended.  This means that editing
  7990.     the same file twice will result in a warning.  Using "/tmp" on Unix is
  7991.     discouraged, when the system crashes you lose the swap file.  That is
  7992.     why a "tmp" directory in your home directory is used first.
  7993.     {Vi: directory to put temp file in, defaults to "/tmp"}
  7994.  
  7995.                *'ed'* *'edcompatible'* *'noed'* *'noedcompatible'*
  7996. edcompatible (ed)    toggle    (default off)
  7997.             global
  7998.     Makes the 'g' and 'c' flags of the ":substitute" command to be
  7999.     toggled each time the flag is given.  See 11.3 |complex_change|.  See
  8000.     also 'gdefault' option.
  8001.  
  8002.                    *'endofline'* *'eol'* *'noendofline'* *'noeol'*
  8003. endofline (eol)        toggle    (default on)
  8004.             local to buffer
  8005.             {not in Vi}
  8006.     When writing a file and this option is off and the 'binary' option
  8007.     is on, no end of line (newline) character will be written for the
  8008.     last line in the file.  This option is automatically set when
  8009.     starting to edit a new file, unless the file does not have an end of
  8010.     line (newline) for the last line in the file, in which case it is
  8011.     reset.  Normally you don't have to set or reset this option.  When
  8012.     'binary' is off the value is not used when writing the file.  When
  8013.     'binary' is on it is used to remember the presence of a newline for
  8014.     the last line in the file, so that when you write the file the
  8015.     situation from the original file can be kept.  But you can change it
  8016.     when you want to.
  8017.  
  8018.                  *'equalalways'* *'ea'* *'noequalalways'* *'noea'*
  8019. equalalways (ea)    toggle    (default on)
  8020.             global
  8021.             {not in Vi}
  8022.     When on all the windows are automatically made the same size after
  8023.     splitting or closing a window.  When off, splitting a window will
  8024.     reduce the size of the current window and leave the other windows the
  8025.     same.  When closing a window the extra lines are given the the window
  8026.     above it.
  8027.  
  8028.                         *'equalprg'* *'ep'*
  8029. equalprg (ep)        string    (default "")
  8030.             global
  8031.             {not in Vi}
  8032.     External program to use for "=" command.  When this option is empty
  8033.     the internal formatting functions are used ('lisp' or 'cindent').
  8034.     Environment variables are expanded |:set_env|.  See |option_backslash|
  8035.     about including spaces and backslashes.
  8036.  
  8037.                    *'errorbells'* *'eb'* *'noerrorbells'* *'noeb'*
  8038. errorbells (eb)        toggle    (default off)
  8039.             global
  8040.     Ring the bell (beep or screen flash) for error messages.  This only
  8041.     makes a difference for error messages, the bell will be used always
  8042.     for a lot of errors without a message (e.g., hitting <Esc> in Normal
  8043.     mode).  See 'visualbell' on how to make the bell behave like a beep,
  8044.     screen flash or do nothing.
  8045.  
  8046.                         *'errorfile'* *'ef'*
  8047. errorfile (ef)        string    (default "AztecC.Err" or "errors.vim")
  8048.             global
  8049.             {not in Vi}
  8050.     Name of the error file for the QuickFix mode (see 5.5
  8051.     |:make_makeprg|).  Environment variables are expanded |:set_env|.  See
  8052.     |option_backslash| about including spaces and backslashes.
  8053.  
  8054.                         *'errorformat'* *'efm'*
  8055. errorformat (efm)    string    (default is very long)
  8056.             global
  8057.             {not in Vi}
  8058.     Scanf-like description of the format for the lines in the error file
  8059.     (see 5.5 |errorformat|).
  8060.  
  8061.                      *'esckeys'* *'ek'* *'noesckeys'* *'noek'*
  8062. esckeys (ek)        toggle    (default on, off when compiled with COMPATIBLE
  8063.                 defined)
  8064.             global
  8065.             {not in Vi}
  8066.     Function keys that start with an <Esc> are recognized in Insert
  8067.     mode.  When this option is off, the cursor and function keys cannot be
  8068.     used in Insert mode if they start with an <Esc>.  The advantage of
  8069.     this is that the single <Esc> is recognized immediately, instead of
  8070.     after one second.  Instead of resetting this option, you might want to
  8071.     try changing the values for 'timeoutlen' and 'ttimeoutlen'.
  8072.  
  8073.                  *'expandtab'* *'et'* *'noexpandtab'* *'noet'*
  8074. expandtab (et)        toggle    (default off)
  8075.             local to buffer
  8076.             {not in Vi}
  8077.     In Insert mode: Use the appropriate number of spaces to insert a
  8078.     <Tab>.  Spaces are used in indents with the '>' and '<' commands and
  8079.     when 'autoindent' is on.  To insert a real tab when 'expandtab' is
  8080.     on, use CTRL-V<Tab>.  See also ":retab" command in 11.3 |:retab|
  8081.     and section 4.3.4 |ins_expandtab|.
  8082.  
  8083.                         *'exrc'* *'noexrc'*
  8084. exrc            toggle (default off)
  8085.             global
  8086.             {not in Vi}
  8087.     Enables the reading of .vimrc, .exrc and .gvimrc in the current
  8088.     directory.  If you switch this option on you should also consider
  8089.     setting the 'secure' option (see 3.4 |initialization|).  Using a local
  8090.     .exrc, .vimrc or .gvimrc is a potential security leak, use with care!
  8091.     also see |.vimrc| and |gui_init|.
  8092.  
  8093.                     *'formatoptions'* *'fo'*
  8094. formatoptions (fo)    string (default "tcq", "vt" when compiled with
  8095.                 COMPATIBLE defined)
  8096.             local to buffer
  8097.             {not in Vi}
  8098.     This is a sequence of letters which describes how automatic
  8099.     formatting is to be done.  See |fo_table|.  When the 'paste' option is
  8100.     on, no formatting is done (like 'formatoptions' is empty).  Commas can
  8101.     be inserted for readability.
  8102.  
  8103.                         *'formatprg'* *'fp'*
  8104. formatprg (fp)        string (default "")
  8105.             global
  8106.             {not in Vi}
  8107.     The name of an external program that will be used to format the lines
  8108.     selected with the "gq" command.  The program must take the input on
  8109.     stdin and produce the output on stdout.  The Unix program 'fmt' is
  8110.     such a program.  If this option is an empty string, the internal
  8111.     format function will be used |C_indenting|.  Environment variables are
  8112.     expanded |:set_env|.  See |option_backslash| about including spaces
  8113.     and backslashes.
  8114.  
  8115.                    *'gdefault'* *'gd'* *'nogdefault'* *'nogd'*
  8116. gdefault (gd)        toggle    (default off)
  8117.             global
  8118.             {not in Vi}
  8119.     When on, the ":substitute" flag 'g' is default on.  This means that
  8120.     all matches in a line are substituted instead of one.  When a 'g' flag
  8121.     is given to a ":substitute" command, this will toggle the substitution
  8122.     of all or one match.  See 11.3 |complex_change|.
  8123.  
  8124.         command        'gdefault' on    'gdefault' off
  8125.         :s///          subst. all      subst. one
  8126.         :s///g          subst. one      subst. all
  8127.         :s///gg          subst. all      subst. one
  8128.  
  8129.                         *'guifont'* *'gfn'*
  8130. guifont (gfn)        string  (default "")
  8131.             global
  8132.             {not in Vi}
  8133.             {Only available when compiled with GUI enabled}
  8134.     This is a list of fonts which should be tried when starting the GUI
  8135.     version of vim.  The fonts are separated with commas.  Spaces after a
  8136.     comma are ignored.  To include a comma in a font name precede it with
  8137.     a backslash.  Setting an option requires an extra backslash before a
  8138.     space and a backslash.  See also |option_backslash|.  For example:
  8139.         :set guifont=Screen15,\ 7x13,font\\,with\\,commas
  8140.     will make vim try to use the font "Screen15" first, and if it fails
  8141.     it will try to use "7x13" and then "font,with,commas" instead.  If
  8142.     none of the fonts can be loaded, vim will try using other resource
  8143.     settings (for X, it will use the Vim.font resource), and finally it
  8144.     will try some builtin default which should always be there ("7x13" in
  8145.     the case of X).  The font names given should be "normal" fonts.  Vim
  8146.     will try to find the related bold and italic fonts.
  8147.  
  8148.                         *'guioptions'* *'go'*
  8149. guioptions (go)        string  (default "agmr")
  8150.             global
  8151.             {not in Vi}
  8152.             {Only available when compiled with GUI enabled}
  8153.     This option only has an effect in the GUI version of vim.  It is a
  8154.     sequence of letters which describes what components and options of the
  8155.     GUI should be used.  Valid letters are as follows:
  8156.  
  8157.       'a'    Autoselect:  If present, then whenever VISUAL mode is started,
  8158.         or the Visual area extended, vim tries to become the owner of
  8159.         the windowing system's global selection.  This means that the
  8160.         Visually highlighted text is available for pasting into other
  8161.         applications as well as into vim itself.  When the Visual mode
  8162.         ends, possibly due to an operation on the text, or when an
  8163.         application wants to paste the selection, the highlighted text
  8164.         is automatically yanked into the <"*> GUI selection register.
  8165.         Thus the selection is still available for pasting into other
  8166.         applications after the VISUAL mode has ended.
  8167.             If not present, then vim won't become the owner of the
  8168.         windowing system's global selection unless explicitly told to
  8169.         by selecting "Cut" or "Copy" etc from the "Edit" menu (which
  8170.         have not been implemented yet!).
  8171.  
  8172.       'f'    Foreground: Don't use fork() to detatch the GUI from the shell
  8173.         where it was started.  Use this for programs that wait for the
  8174.         editor to finish (e.g., an e-mail program).  Altenatively you
  8175.         can use "gvim -f" or ":gui -f" to start the GUI in the
  8176.         foreground.  |gui_fork|
  8177.  
  8178.       'm'    Menu bar is present when 'm' is included.
  8179.       'g'    Grey menu items: Make menu items that are not active grey.  If
  8180.         'g' is not included inactive menu items are not shown at all.
  8181.  
  8182.       'r'    Right-hand scrollbar is present when 'r' is included.
  8183.       'l'    Left-hand scrollbar is present when 'l' is included.
  8184.       'b'    Bottom (horizontal) scrollbar is present when 'b' is included.
  8185.  
  8186.     And yes, you may even have scrollbars on the left AND the right if
  8187.     you really want to :-).  See |gui_scrollbars| for more information.
  8188.  
  8189.                         *'guipty'* *'noguipty'*
  8190. guipty            toggle    (default off)
  8191.             global
  8192.             {not in Vi}
  8193.             {Only available when compiled with GUI enabled}
  8194.     Only in the GUI: If on, an attempt is made to open a pseudo-tty for
  8195.     I/O to/from shell commands.  See |gui_pty|.
  8196.  
  8197.                     *'helpfile'* *'hf'*
  8198. helpfile (hf)        string    (default (Amiga) "vim:vim_help.txt"
  8199.                  (MS-DOS, Win32, OS/2) "$VIM/vim_help.txt"
  8200.                  (Unix) "/usr/local/lib/vim/vim_help.txt")
  8201.             global
  8202.             {not in Vi}
  8203.     Name of the help file.  All help files should be placed together in
  8204.     one directory.  Environment variables are expanded |:set_env|.  For
  8205.     example: "$VIM/doc/vim_help.txt".  If $VIM is not set, $HOME is also
  8206.     tried.  For Unix the default is adjusted at compile time to where the
  8207.     help files are being installed.  See |option_backslash| about
  8208.     including spaces and backslashes.
  8209.  
  8210.                         *'helpheight'* *'hh'*
  8211. helpheight (hh)        number    (default 20)
  8212.             global
  8213.             {not in Vi}
  8214.     Minimal initial height of the help window when it is opened with the
  8215.     ":help" command.  The initial height of the help window is half of the
  8216.     current window, or (when the 'ea' option is on) the same as other
  8217.     windows.  When the height is less than 'helpheight', the height is
  8218.     set to 'helpheight'.  Set to zero to disable.
  8219.  
  8220.                      *'hidden'* *'hid'* *'nohidden'* *'nohid'*
  8221. hidden (hid)        toggle    (default off)
  8222.             global
  8223.             {not in Vi}
  8224.     When off the current buffer is unloaded when it is abandoned.  When
  8225.     on the current buffer becomes hidden when starting to edit another
  8226.     buffer.  If the current buffer is also displayed in another window it
  8227.     does not become hidden.  The commands that move through the buffer
  8228.     list make the current buffer hidden although the 'hidden' option is
  8229.     off.  See also |vim_win.txt|.
  8230.  
  8231.                         *'highlight'* *'hl'*
  8232. highlight (hl)        string    (default "8b,db,es,mb,Mn,nu,rs,sr,tb,vr,ws")
  8233.             global
  8234.             {not in Vi}
  8235.     This option can be used to set highlighting mode for various
  8236.     occasions.  It is a comma separated list of character pairs.  The
  8237.     first character in a pair gives the occasion, the second the mode to
  8238.     use for that occasion.  The occasions are:
  8239.         8    Meta & special keys listed with ":map"
  8240.         d    directories in CTRL-D listing
  8241.         e    error messages
  8242.         m    "--More--" message
  8243.         M    Mode (e.g., "-- INSERT --")
  8244.         n    line number for ":number" and ":#" commands
  8245.         r    return to continue message and yes/no questions
  8246.         s    status lines
  8247.         t    Titles for output from ":set all", ":autocmd" etc.
  8248.         v    Visual mode
  8249.         w    warning messages
  8250.     The display modes are:
  8251.         r    reverse        (termcap entry "mr" and "me")
  8252.         i    italic        (termcap entry "ZH" and "ZR")
  8253.         b    bold        (termcap entry "md" and "me")
  8254.         s    standout    (termcap entry "so" and "se")
  8255.         u    underline    (termcap entry "us" and "ue")
  8256.         n    no highlighting
  8257.     The default is used for occasions that are not included.
  8258.     If you want to change what the display modes do, see |colors| for an
  8259.     example.
  8260.  
  8261.                         *'history'* *'hi'*
  8262. history (hi)        number    (default 20)
  8263.             global
  8264.             {not in Vi}
  8265.     A history of ":" commands, and a history of previous search patterns
  8266.     are remembered.  This option decides how many entries may be stored in
  8267.     each of these histories (see |cmdline_editing|).
  8268.  
  8269.                      *'hkmap'* *'hk'* *'nohkmap'* *'nohk'*
  8270. hkmap (kh)        toggle  (default off)
  8271.             global
  8272.             {not in Vi}
  8273.             {Only available if Vim was compiled with RIGHTLEFT
  8274.             defined}
  8275.     When on, the keyboard is mapped for the Hebrew character set.
  8276.     Normally you would use CTRL-_ in insert mode to toggle this option.
  8277.     See |vim_rlh.txt|.
  8278.  
  8279.                         *'icon'* *'noicon'*
  8280. icon            toggle    (default off, on when title can be restored)
  8281.             global
  8282.             {not in Vi}
  8283.     When on the icon of the window will be set to the name of the file
  8284.     currently being edited.  Only the last part of the name is used.  Only
  8285.     works if the terminal supports setting window icons (currently only
  8286.     Unix xterm and iris-ansi).  When Vim was compiled with HAVE_X11
  8287.     defined, the original icon will be restored if possible |X11|.
  8288.  
  8289.                    *'ignorecase'* *'ic'* *'noignorecase'* *'noic'*
  8290. ignorecase (ic)        toggle    (default off)
  8291.             global
  8292.     Ignore case in search patterns.  Also used when searching in the tags
  8293.     file.
  8294.  
  8295.                         *'include'* *'inc'*
  8296. include (inc)        string    (default "^#[ \t]*include")
  8297.             global
  8298.             {not in Vi}
  8299.     Pattern to be used to find an include command.  It is a search
  8300.     pattern, just like for the "/" command (See 6.6, "Pattern
  8301.     searches" |search_pattern|).  The default value is for C programs.
  8302.     This option is used for the commands "[i", "]I", "[d", etc..  The
  8303.     'isfname' option is used to recognize the file name that comes after
  8304.     the matched pattern.  See |option_backslash| about including spaces
  8305.     and backslashes.
  8306.  
  8307.                  *'incsearch'* *'is'* *'noincsearch'* *'nois'*
  8308. incsearch (is)        toggle    (default off)
  8309.             global
  8310.             {not in Vi}
  8311.     While typing a search pattern, show immediately where the so far
  8312.     typed pattern matches.  The matched string is highlighted.  If the
  8313.     pattern is invalid or not found, nothing is shown.  The screen will
  8314.     be updated often, this is only useful on fast terminals.  Note that
  8315.     the match will be shown, but the cursor is not actually positioned
  8316.     there.  You still need to finish the search command with <CR> to move
  8317.     the cursor.
  8318.  
  8319.                    *'infercase'* *'inf'* *'noinfercase'* *'noinf'*
  8320. infercase (inf)        toggle    (default off)
  8321.             local to buffer
  8322.             {not in Vi}
  8323.     When doing keyword completion in insert mode |ins_completion|, and
  8324.     'ignorecase' is also on, the case of the match is adjusted.  If the
  8325.     typed text contains a lowercase letter where the match has an upper
  8326.     case letter, the completed part is made lower case.  If the typed text
  8327.     has no lower case letters and the match has a lower case letter where
  8328.     the typed text has an upper case letter, and there is a letter before
  8329.     it, the completed part is made uppercase.
  8330.  
  8331.                    *'insertmode'* *'im'* *'noinsertmode'* *'noim'*
  8332. insertmode (im)        toggle    (default off)
  8333.             global
  8334.             {not in Vi}
  8335.     Start the edit of a file in Insert mode.  Useful if you want to use
  8336.     Vim like a modeless editor (use the cursor keys to move around, use
  8337.     CTRL-O for other commands |i_CTRL-O|).
  8338.  
  8339.                         *'isfname'* *'isf'*
  8340. isfname (isf)        string    (default for MS-DOS, Win32 and OS/2:
  8341.                         "@,48-57,/,.,-,_,+,,,$,:,\"
  8342.                  for AMIGA: "@,48-57,/,.,-,_,+,,,$,:"
  8343.                  otherwise: "@,48-57,/,.,-,_,+,,,$,:,~")
  8344.             global
  8345.             {not in Vi}
  8346.     The characters given by this option are included in file names and
  8347.     path names.  File names are used for commands like "gf", "[i" and in
  8348.     the tags file.  Besides the characters in this option characters that
  8349.     are defined by the C function isalpha() are also always included
  8350.     (this depends on the character set and "locale").
  8351.  
  8352.     The format of this option is a list of parts, separated with commas.
  8353.     Each part can be a single character number or a range.  A range is two
  8354.     character numbers with '-' in between.  A character number can be a
  8355.     decimal number between 0 and 255 or the ASCII character itself (does
  8356.     not work for digits).  Example:
  8357.         "_,-,128-140,#-43"    (include '_' and '-' and the range
  8358.                     128 to 140 and '#' to 43)
  8359.     If a part starts with '^', the following character number or range
  8360.     will be excluded from the option.  The option is interpreted from left
  8361.     to right.  Put the excluded character after the range where it is
  8362.     included.  To include '^' itself use it as the last character of the
  8363.     option or the end of a range.  Example:
  8364.         "^a-z,#,^"    (exclude 'a' to 'z', include '#' and '^')
  8365.     If the character is '@', all characters where isalpha() returns TRUE
  8366.     are included.  Normally these are the characters a to z and A to Z,
  8367.     plus accented characters.  To include '@' itself use "@-@".  Examples:
  8368.         "@,^a-z"    All alphabetic characters, excluding lower
  8369.                 case letters.
  8370.         "a-z,A-Z,@-@"    All letters plus the '@' character.
  8371.     A comma can be included by using it where a character number is
  8372.     expected.  Example:
  8373.         "48-57,,,_"    Digits, command and underscore.
  8374.     A comma can be excluded by prepending a '^'.  Example:
  8375.         " -~,^,,9"    All characters from space to '~', excluding
  8376.                 comma, plus <Tab>.
  8377.     See |option_backslash| about including spaces and backslashes.
  8378.  
  8379.                         *'isident'* *'isi'*
  8380. isident (isi)    string    (default for MS-DOS, Win32 and OS/2:
  8381.                        "@,48-57,_,128-167,224-235"
  8382.                 otherwise: "@,48-57,_,192-255")
  8383.             global
  8384.             {not in Vi}
  8385.     The characters given by this option are included in identifiers.
  8386.     Identifiers are used in recognizing environment variables and after
  8387.     a match of the 'define' option.  See 'isfname' for a description of
  8388.     the format of this option.
  8389.  
  8390.                         *'iskeyword'* *'isk'*
  8391. iskeyword (isk)         string (default for MS-DOS and Win32:
  8392.                         "@,48-57,_,128-167,224-235"
  8393.                 otherwise:  "@,48-57,_,192-255"
  8394.                 but when compiled with COMPATIBLE defined:
  8395.                         "@,48-57,_")
  8396.             local to buffer
  8397.             {not in Vi}
  8398.     Keywords are used in searching and recognizing with many commands:
  8399.     "w", "*", "[i", etc.  See 'isfname' for a description of the format of
  8400.     this option.  For C programs you could use "a-z,A-Z,48-57,_,.,-,>".
  8401.     For a help file it is set to all non-blank printable characters except
  8402.     '*', '"' and '|'.  When the 'lisp' option is on the '-' character is
  8403.     always included.
  8404.  
  8405.                         *'isprint'* *'isp'*
  8406. isprint (isp)    string    (default for MS-DOS and Win32: "@,~-255"
  8407.                   otherwise:           "@,161-255")
  8408.             global
  8409.             {not in Vi}
  8410.     The characters given by this option are displayed directly on the
  8411.     screen.  The characters from space (ascii 32) to '~' (ascii 126) are
  8412.     always displayed directly, even when they are not included in
  8413.     'isprint' or excluded.  See 'isfname' for a description of the format
  8414.     of this option.  Non-printable characters are displayed with two
  8415.     characters:
  8416.           0 -  31    "^@" - "^_"
  8417.          32 - 126    always single characters
  8418.            127        "^?"
  8419.         128 - 159    "~@" - "~_"
  8420.         160 - 254    "| " - "|~"
  8421.            255        "~?"
  8422.  
  8423.                    *'joinspaces'* *'js'* *'nojoinspaces'* *'nojs'*
  8424. joinspaces (js)        toggle    (default on)
  8425.             global
  8426.             {not in Vi}
  8427.     Insert two spaces after a period with a join command.
  8428.  
  8429.                     *'keywordprg'* *'kp'*
  8430. keywordprg (kp)        string    (default "man")
  8431.             global
  8432.             {not in Vi}
  8433.     Program to use for the "K" command.  Environment variables are
  8434.     expanded |:set_env|.  When empty ":help" is used.  See
  8435.     |option_backslash| about including spaces and backslashes.
  8436.  
  8437.                     *'langmap'* *'lmap'*
  8438. langmap (lmap)        string    (default "")
  8439.             global
  8440.             {not in Vi}
  8441.             {Only included when Vim was compiled with HAVE_LANGMAP
  8442.             defined (Check ":version" for "+langmap").
  8443.     This option allows support for keyboards that have a mode for a
  8444.     special language.  The idea is that when you are typing text in Insert
  8445.     mode your keyboard is switched in the special language mode, you get
  8446.     different key codes for the special characters.  When in command mode
  8447.     the 'langmap' option takes care of translating these special
  8448.     characters to the original meaning of the key.  This means you don't
  8449.     have to change the keyboard mode to be able to execute normal mode
  8450.     commands.
  8451.  
  8452.     Example (for greek):                    *greek*
  8453.         :set langmap=┴A,┬B,╪C,─D,┼E,╓F,├G,╟H,╔I,╬J,╩K,╦L,╠M,═N,╧O,╨P,QQ,╤R,╙S,╘T,╚U,┘V,WW,╫X,╒Y,╞Z,ßa,Γb,°c,Σd,σe,÷f,πg,τh,Θi,εj,Ωk,δl,∞m,φn,∩o,≡p,qq,±r,≤s,⌠t,Φu,∙v,≥w,≈x,⌡y,µz
  8454.     Example (exchanges meaning of z and y for commands):
  8455.         :set langmap=zy,yz,ZY,YZ
  8456.  
  8457.     The 'langmap' option is a list of parts, separated with commas.  Each
  8458.     part can be in one of two forms:
  8459.     1.  A list of pairs.  Each pair is a "from" character immediately
  8460.         followed by the "to" character.  Examples: "aA", "aAbBcC".
  8461.     2.  A list of "from" characters, a semi-colon and a list of "to"
  8462.         characters.  Example: "abc;ABC"
  8463.     Example: "aA,fgh;FGH,cCdDeE"
  8464.     Special characters need to be preceded with a backslash.  These are
  8465.     ";", ',' and backslash itself.
  8466.  
  8467.     This will allow you to activate vim actions without having to switch
  8468.     back and forth between the languages.  Your language characters will
  8469.     be understood as normal vim English characters (according to the
  8470.     langmap mappings) in the following cases:
  8471.      o Normal/Visual mode (commands, buffer/register names, user mappings)
  8472.      o Insert/Replace Mode: Register names after CTRL-R
  8473.      o Insert/Replace Mode: Mappings
  8474.     Characters entered in Command-line mode will NOT be affected by
  8475.     this option.   Note that this option can be changed at any time
  8476.     allowing to switch between mappings for different languages/encodings.
  8477.     Use a mapping to avoid having to type it each time!
  8478.  
  8479.                     *'laststatus'* *'ls'*
  8480. laststatus (ls)        number    (default 1)
  8481.             global
  8482.             {not in Vi}
  8483.     The value of this option influences when the last window will have a
  8484.     status line:
  8485.         0: never
  8486.         1: only if there are at least two windows
  8487.         2: always
  8488.     The screen looks nicer with a status line if you have several
  8489.     windows, but it takes another screen line.
  8490.  
  8491.                    *'linebreak'* *'lbr'* *'nolinebreak'* *'nolbr'*
  8492. linebreak (lbr)        toggle    (default off)
  8493.             local to window
  8494.             {not in Vi}
  8495.     If on Vim will wrap long lines at a character in 'breakat' rather
  8496.     than at the last character that fits on the screen.  Unlike
  8497.     'wrapmargin' and 'textwidth', this does not insert newline characters
  8498.     in the file, it only affects the way the file is displayed, not its
  8499.     contents.  The value of 'showbreak' is used to put in front of wrapped
  8500.     lines.  This option is not used when the 'wrap' option is off.  Note
  8501.     that <Tab> characters after a line break are mostly not displayed
  8502.     correctly.
  8503.  
  8504.                         *'lines'*
  8505. lines            number    (default 24 or terminal height)
  8506.             global
  8507.     Number of lines in the display.  Normally you don't need to set this.
  8508.     That is done automatically by the terminal initialization code.  When
  8509.     you do set this, and Vim is unable to change the physical number of
  8510.     lines on the display, redisplaying may be wrong.
  8511.  
  8512.                         *'lisp'* *'nolisp'*
  8513. lisp            toggle    (default off)
  8514.             local to buffer
  8515.             {Only included when compiled with LISPINDENT enabled,
  8516.             ":version" says "+lispindent" instead of
  8517.             "-lispindent"}
  8518.     Lisp mode: When a return is typed in insert mode set the indent for
  8519.     the next line to Lisp standards (well, sort of).  Also happens with
  8520.     "cc" or "S".  'autoindent' must also be on for this to work.  The '-'
  8521.     character is included in keyword characters.  Redefines the "="
  8522.     operator to use this same indentation algorithm rather than calling an
  8523.     external program if 'equalprg' is empty.  This option is reset when
  8524.     'paste' is set.  {Vi: Does it a little bit differently}
  8525.  
  8526.                         *'list'* *'nolist'*
  8527. list            toggle    (default off)
  8528.             local to window
  8529.     List mode: Show tabs as CTRL-I, show end of line with $.  Useful to
  8530.     see the difference between tabs and spaces and for trailing blanks.
  8531.     Note that this will also affect formatting (set with 'textwidth' or
  8532.     'wrapmargin').
  8533.  
  8534.                         *'magic'* *'nomagic'*
  8535. magic            toggle    (default on)
  8536.             global
  8537.     Changes the special characters that can be used in search patterns.
  8538.     See section "Pattern searches" |search_pattern|.
  8539.  
  8540.                         *'makeprg'* *'mp'*
  8541. makeprg (mp)        string    (default "make")
  8542.             global
  8543.             {not in Vi}
  8544.     Program to use for the ":make" command.  See |:make_makeprg|.  This
  8545.     option may contain '%' and '#' characters, which are expanded like
  8546.     when used in a command line.  Environment variables are expanded
  8547.     |:set_env|.  See |option_backslash| about including spaces and
  8548.     backslashes.
  8549.  
  8550.                         *'maxmapdepth'* *'mmd'*
  8551. maxmapdepth (mmd)    number    (default 1000)
  8552.             global
  8553.             {not in Vi}
  8554.     Maximum number of times a mapping is done without resulting in a
  8555.     character to be used.  This normally catches endless mappings, like
  8556.     ":map x y" with ":map y x".  It still does not catch ":map g wg",
  8557.     because the 'w' is used before the next mapping is done.  See also
  8558.     |key_mapping|.
  8559.  
  8560.                         *'maxmem'* *'mm'*
  8561. maxmem (mm)        number    (default 512)
  8562.             global
  8563.             {not in Vi}
  8564.     Maximum amount of memory (in Kbyte) to use for one buffer.  When this
  8565.     limit is reached allocating extra memory for a buffer will cause
  8566.     other memory to be freed.  See also 'maxmemtot'.
  8567.  
  8568.                         *'maxmemtot'* *'mmt'*
  8569. maxmemtot (mmt)        number    (default 2048, or half the amount of memory
  8570.                 available)
  8571.             global
  8572.             {not in Vi}
  8573.     Maximum amount of memory (in Kbyte) to use for all buffers together.
  8574.     See also 'maxmem'.
  8575.  
  8576.                    *'modeline'* *'ml'* *'nomodeline'* *'noml'*
  8577. modeline (ml)        toggle    (default on, off when compiled with COMPATIBLE
  8578.                 defined)
  8579.             local to buffer
  8580.                         *'modelines'* *'mls'*
  8581. modelines (mls)        number    (default 5)
  8582.             global
  8583.             {not in Vi}
  8584.     If 'modeline' is on 'modelines' gives the number of lines that is
  8585.     checked for set commands.  If 'modeline' is off or 'modelines' is zero
  8586.     no lines are checked.  See 19.1 |modeline|.  'modeline' is reset when
  8587.     'compatible' is set.
  8588.  
  8589.                  *'modified'* *'mod'* *'nomodified'* *'nomod'*
  8590. modified (mod)        toggle    (default off)
  8591.             local to buffer
  8592.             {not in Vi}
  8593.     When on the buffer is considered to be modified.  This option is set
  8594.     by every command that makes a change to the buffer.  Only the undo
  8595.     command may reset it, when all changes have been undone.
  8596.  
  8597.                         *'more'* *'nomore'*
  8598. more            toggle    (default on, off when compiled with COMPATIBLE
  8599.                 defined)
  8600.             global
  8601.             {not in Vi}
  8602.     Listings pause when the whole screen is filled.  Type:
  8603.          <CR> or <NL>   for one more line.
  8604.          <Space>        for the next page.
  8605.          'd'            for down half a page.
  8606.          'q' or CTRL-C  to stop the listing.
  8607.          ':'            to stop the listing and enter a command line.
  8608.     Any other key causes the meaning of the keys to be displayed.
  8609.     When this option is off there are no pauses, the listing continues
  8610.     until finished.  When 'compatible' is set this option is reset.
  8611.     Note: The key typed at the "more" prompt is directly obtained from the
  8612.     terminal, it is not mapped and typeahead is ignored.
  8613.  
  8614.                         *'mouse'*
  8615. mouse            string    (default "", "a" for MS-DOS and Win32)
  8616.             global
  8617.             {not in Vi}
  8618.     Enable the use of the mouse.  Only works for certain terminals
  8619.     (MS-DOS, Win32 and xterm).  The mouse can be enabled for different
  8620.     modes:
  8621.         n    Normal mode
  8622.         v    Visual mode
  8623.         i    Insert mode
  8624.         c    Command-line mode
  8625.         h    all previous modes when editing a help file
  8626.         a    all previous modes
  8627.         r    for "Hit return ..." question
  8628.     Normally you would enable the mouse in all four modes with:
  8629.         :set mouse=a
  8630.     Note: Normal copy/paste in an xterm can still be used by pressing the
  8631.     shift key when the mouse is being used by Vim.  See |mouse_using|.
  8632.  
  8633.                         *'mousetime'* *'mouset'*
  8634. mousetime (mouset)    number    (default 500)
  8635.             global
  8636.             {not in Vi}
  8637.     Only for GUI, MS-DOS, Win32 and Unix with xterm.  Defines the maximum
  8638.     time in msec between two mouse clicks for the second click to be
  8639.     recognized as a multi click.
  8640.  
  8641.                        *'number'* *'nu'* *'nonumber'* *'nonu'*
  8642. number (nu)        toggle    (default off)
  8643.             local to window
  8644.     Print the line number in front of each line.  Tip: If you don't like
  8645.     wrapping lines to mix with the line numbers, set the 'showbreak'
  8646.     option to eight spaces:
  8647.         :set showbreak=\ \ \ \ \ \ \ \ 
  8648.  
  8649.             *'paragraphs'* *'para'*
  8650. paragraphs (para)    string    (default "IPLPPPQPP LIpplpipbp")
  8651.             global
  8652.     Specifies the nroff macros that separate paragraphs.  These are pairs
  8653.     of two letters (see section 6.4 |object_motions|).
  8654.  
  8655.                         *'paste'* *'nopaste'*
  8656. paste            toggle    (default off)
  8657.             global
  8658.             {not in Vi}
  8659.     Put Vim in Paste mode.  This is useful if you want to cut or copy
  8660.     some text from one window and paste it in Vim.  This will avoid
  8661.     unexpected effects.  When the 'paste' option is switched on (also when
  8662.     it was already on):
  8663.         - mapping in Insert mode is disabled
  8664.         - abbreviations are disabled
  8665.         - 'textwidth' is set to 0
  8666.         - 'autoindent' is reset
  8667.         - 'smartindent' is reset
  8668.         - 'cindent' is reset
  8669.         - 'lisp' is reset
  8670.         - 'revins' is reset
  8671.         - 'ruler' is reset
  8672.         - 'showmatch' is reset
  8673.         - 'formatoptions' is used like it is empty
  8674.     NOTE: When you start editing another file while the 'paste' option is
  8675.     on, settings from the modelines or autocommands may change the
  8676.     settings again, causing trouble when pasting text.  You might want to
  8677.     set the 'paste' option again.
  8678.     When the 'paste' option is reset the mentioned options are restored to
  8679.     the value before the moment 'paste' was switched from off to on.
  8680.     Resetting 'paste' before ever setting it does not have any effect.  If
  8681.     you use this often, you could map a function key to the command ":set
  8682.     invpaste^V^M".
  8683.  
  8684.                         *'patchmode'* *'pm'*
  8685. patchmode (pm)        string    (default "")
  8686.             global
  8687.             {not in Vi}
  8688.     When non-empty the oldest version of a file is kept.  This can be used
  8689.     to keep the original version of a file if you are changing files in a
  8690.     source distribution.  Only the first time that a file is edited a copy
  8691.     of the original file will be kept.  The name of the copy is the name
  8692.     of the original file with the string in the 'patchmode' option
  8693.     appended.  This option should start with a dot.  Use a string like
  8694.     ".org".  'backupdir' must not be empty for this to work (Detail: The
  8695.     backup file is renamed to the patchmode file after the new file has
  8696.     been succesfully written, that's why it must be possible to write a
  8697.     backup file).  If there was no file to be backed up, an empty file is
  8698.     created.
  8699.  
  8700.                         *'path'* *'pa'*
  8701. path (pa)        string    (default on Unix: ".,/usr/include,,"
  8702.                    on OS/2:       ".,/emx/include,,"
  8703.                    other systems: ".,,")
  8704.             global
  8705.             {not in Vi}
  8706.     This is a list of directories which will be searched when using the
  8707.     gf, [f, ]f, ^Wf and other commands, provided that the file being
  8708.     searched for has a relative path (not starting with '/').  The
  8709.     directories in the 'path' option may be relative or absolute.
  8710.     - Use commas to separate directory names:
  8711.         :set path=.,/usr/local/include,/usr/include
  8712.     - Spaces can also be used to separate directory names (for backwards
  8713.       compatibility with version 3.0).  To have a space in a directory
  8714.       name, precede it with an extra backslash:
  8715.           :set path=.,/dir/with\\ space
  8716.     - To include a comma in a directory name precede it with an extra
  8717.       backslash:
  8718.           :set path=.,/dir/with\\,comma
  8719.     - To search relative to the directory where the current file is use
  8720.           :set path=.
  8721.     - To search in the current directory use an empty string between two
  8722.       commas:
  8723.         :set path=,,
  8724.     - A directory name may end in a ':' or '/'.
  8725.     - Environment variables are expanded |:set_env|.
  8726.     - Careful with '\' characters, type two to get one in the option:
  8727.         :set path=.,c:\\include
  8728.       Or just use '/' instead:
  8729.         :set path=.,c:/include
  8730.     Don't forget "." or files won't even be found in the same directory as
  8731.     the file!
  8732.  
  8733.                    *'readonly'* *'ro'* *'noreadonly'* *'noro'*
  8734. readonly (ro)        toggle    (default off)
  8735.             local to buffer
  8736.             {not in Vi}
  8737.     If on, writes fail unless you use a '!'.  Protects you from
  8738.     accidentally overwriting a file.  Default on when Vim is started
  8739.     in view mode ("vim -v") or when the executable is called "view".
  8740.     {not in Vi:}  When using the ":view" command the 'readonly' option is
  8741.     set for the newly edited buffer.  When using ":w!" the 'readonly'
  8742.     option is reset for the current buffer.
  8743.  
  8744.                         *'remap'* *'noremap'*
  8745. remap            toggle    (default on)
  8746.             global
  8747.     Allows for mappings to work recursively.  If you do not want this for
  8748.     a single entry, use the :noremap[!] command.
  8749.  
  8750.                         *'report'*
  8751. report            number    (default 2)
  8752.             global
  8753.     Threshold for reporting number of lines changed.  When the number of
  8754.     changed lines is more than 'report' a message will be given for most
  8755.     ":" commands.  For the ":substitute" command the number of
  8756.     substitutions is used instead of the number of lines.
  8757.  
  8758.              *'restorescreen'* *'rs'* *'norestorescreen'* *'nors'*
  8759. restorescreen (rs)    toggle    (default on)
  8760.             global
  8761.             {not in Vi}  {Windows 95/NT version only}
  8762.     When set, the screen contents is restored when exiting Vim.  This also
  8763.     happens when executing external commands.
  8764.  
  8765.                        *'revins'* *'ri'* *'norevins'* *'nori'*
  8766. revins (ri)        toggle    (default off)
  8767.             global
  8768.             {not in Vi}
  8769.             {only when compiled with RIGHTLEFT defined}
  8770.     Inserting characters in Insert mode will work backwards.  See "typing
  8771.     backwards" |ins_reverse|.  This option can be toggled with the CTRL-B
  8772.     command in Insert mode.  This option is reset when 'compatible' or
  8773.     'paste' is set.
  8774.  
  8775.                  *'rightleft'* *'rl'* *'norightleft'* *'norl'*
  8776. rightleft (rl)        toggle    (default off)
  8777.             local to window
  8778.             {not in Vi}
  8779.             {only when compiled with RIGHTLEFT defined}
  8780.     When on, display orientation becomes right-to-left, i.e., character
  8781.     that are stored in the file apear from the right to the left.  Using
  8782.     this option, it is possible to edit files for languages that are
  8783.     written from the right to the left such as Hebrew and Arabic.  This
  8784.     option is per window, so it is possible to edit mixed files
  8785.     simultaneously, or to view the same file in both ways (this is
  8786.     sometimes usefull when editing Hebrew TeX--XeT files).  See
  8787.     |vim_rlh.txt|.
  8788.  
  8789.                      *'ruler'* *'ru'* *'noruler'* *'noru'*
  8790. ruler (ru)        toggle    (default off)
  8791.             global
  8792.             {not in Vi}
  8793.     Show the line and column number of the cursor position in the status
  8794.     line, separated by a comma.  If there are characters in the line that
  8795.     take two positions on the screen, both the "real" column and the
  8796.     screen column are shown, separated with a dash.  For an empty line
  8797.     "0-1" is shown.  For an empty buffer the line number will also be
  8798.     zero: "0,0-1".  This option is reset when the 'paste' option is set.
  8799.     If you don't want to see the ruler all the time but want to know where
  8800.     you are, use "g CTRL-G" |g_CTRL-G|.
  8801.  
  8802.                         *'scroll'* *'scr'*
  8803. scroll (scr)        number    (default 'lines' / 2)
  8804.             local to window
  8805.     Number of lines to scroll with CTRL-U and CTRL-D commands.  Will be
  8806.     set to half the number of lines in the window when the window size
  8807.     changes.  If you give a count to the CTRL-U or CTRL-D command it will
  8808.     be used as the new value for 'scroll'.  Reset to 'lines' / 2 with
  8809.     ":set scroll=0".   {difference from vi: 'scroll' gives the number of
  8810.     screen lines instead of file lines, makes a difference when lines
  8811.     wrap}
  8812.  
  8813.                         *'scrolljump'* *'sj'*
  8814. scrolljump (sj)        number    (default 1)
  8815.             global
  8816.             {not in Vi}
  8817.     Minimal number of lines to scroll when the cursor gets off the
  8818.     screen (e.g., with "j").  Not used for scroll commands (e.g., CTRL-E,
  8819.     CTRL-D).  Useful if your terminal scrolls very slowly.
  8820.  
  8821.                         *'scrolloff'* *'so'*
  8822. scrolloff (so)        number    (default 0)
  8823.             global
  8824.             {not in Vi}
  8825.     Minimal number of screen lines to keep above and below the cursor.
  8826.     This will make some context visible around where you are working.  If
  8827.     you set it to a very large value (999) the cursor line will always be
  8828.     in the middle of the window (except at the start or end of the file or
  8829.     when long lines wrap).
  8830.  
  8831.                         *'sections'* *'sect'*
  8832. sections (sect)        string    (default "SHNHH HUnhsh")
  8833.             global
  8834.     Specifies the nroff macros that separate sections.  These are pairs of
  8835.     two letters (See section 6.4 |object_motions|).
  8836.  
  8837.                         *'secure'* *'nosecure'*
  8838. secure            toggle    (default off)
  8839.             global
  8840.             {not in Vi}
  8841.     When on, ":autocmd", shell and write commands are not allowed in
  8842.     ".vimrc" and ".exrc" in the current directory and map commands are
  8843.     displayed.  Switch it off only if you know that you will not run into
  8844.     problems, or when the 'exrc' option is off.  On Unix this option is
  8845.     only used if the ".vimrc" or ".exrc" is not owned by you.  This can be
  8846.     dangerous if the systems allows users to do a "chown".  You better set
  8847.     'secure' at the end of your ~/.vimrc then.
  8848.  
  8849.                         *'shell'* *'sh'*
  8850. shell (sh)        string    (default $SHELL or "sh",
  8851.                     MS-DOS and Win32: "command",
  8852.                     OS/2: "cmd")
  8853.             global
  8854.     Name of the shell to use for ! and :! commands.  When changing the
  8855.     value also check the 'shelltype', 'shellpipe' and 'shellredir'
  8856.     options.  It is allowed to give an argument to the command, e.g.
  8857.     "csh -f".  See |option_backslash| about including spaces and
  8858.     backslashes.  Environment variables are expanded |:set_env|.
  8859.  
  8860.                         *'shellcmdflag'* *'shcf'*
  8861. shellcmdflag (shcf)    string    (default: "-c", MS-DOS and Win32, when 'shell'
  8862.                     does not contain "sh" somewhere: "/c")
  8863.             global
  8864.             {not in Vi}
  8865.     Flag passed to the shell to execute "!" and ":!" commands; e.g.,
  8866.     "bash.exe -c ls" or "command.com /c dir".  For the MS-DOS-like
  8867.     systems, the default is set according to the value of 'shell', to
  8868.     reduce the need to set this option by the user.  It's not used for
  8869.     OS/2 (EMX figures this out itself).  See |option_backslash| about
  8870.     including spaces and backslashes.  See |win32_shell| for Win32.
  8871.  
  8872.                         *'shellpipe'* *'sp'*
  8873. shellpipe (sp)        string    (default ">", "| tee", "|& tee" or "2>&1| tee")
  8874.             global
  8875.             {not in Vi}
  8876.     String to be used to put the output of the ":make" command in the
  8877.     error file.  See also |:make_makeprg|.  See |option_backslash| about
  8878.     including spaces and backslashes.
  8879.     For the Amiga and MS-DOS the default is ">".  The output is directly
  8880.     saved in a file and not echoed to the screen.
  8881.     For Unix the default it "| tee".  The stdout of the compiler is saved
  8882.     in a file and echoed to the screen.  If the 'shell' option is "csh" or
  8883.     "tcsh" after initializations, the default becomes "|& tee".  If the
  8884.     'shell' option is "sh", "ksh", "zsh" or "bash" the default becomes
  8885.     "2>&1| tee".  This means that stderr is also included.
  8886.     The initialization of this option is done after reading the ".vimrc"
  8887.     and the other initializations, so that when the 'shell' option is set
  8888.     there, the 'shellpipe' option changes automatically, unless it was
  8889.     explicitly set before.
  8890.     In the future pipes may be used for filtering and this option will
  8891.     become obsolete (at least for Unix).
  8892.  
  8893.                         *'shellquote'* *'shq'*
  8894. shellquote (shq)    string    (default: ""; MS-DOS and Win32, when 'shell'
  8895.                     contains "sh" somewhere: "\"")
  8896.             global
  8897.             {not in Vi}
  8898.     Quoting character(s) passed to the shell to execute "!" and ":!"
  8899.     commands.  This is an empty string by default.  Only known to be
  8900.     useful for third-party shells on MS-DOS-like systems, such as the MKS
  8901.     Korn Shell or bash, where it should be "\"".  The default is adjusted
  8902.     according the value of 'shell', to reduce the need to set this option
  8903.     by the user.  See |win32_shell| for Win32.
  8904.  
  8905.                         *'shellredir'* *'srr'*
  8906. shellredir (srr)    string    (default ">", ">&" or ">%s 2>&1")
  8907.             global
  8908.             {not in Vi}
  8909.     String to be used to put the output of a filter in a temporary file.
  8910.     See also |:!|.  See |option_backslash| about including spaces and
  8911.     backslashes.
  8912.     The name of the temporary file can be represented by "%s" if necessary
  8913.     (the file name is appended automatically if no %s appears in the value
  8914.     of this option).
  8915.     The default is ">".  For Unix, if the 'shell' option is "csh", "tcsh"
  8916.     or "zsh" during initializations, the default becomes ">&".  If the
  8917.     'shell' option is "sh", "ksh" or "bash" the default becomes
  8918.     ">%s 2>&1".  This means that stderr is also included.
  8919.     The initialization of this option is done after reading the ".vimrc"
  8920.     and the other initializations, so that when the 'shell' option is set
  8921.     there, the 'shellredir' option changes automatically unless it was
  8922.     explicitly set before.
  8923.     In the future pipes may be used for filtering and this option will
  8924.     become obsolete (at least for Unix).
  8925.  
  8926.                         *'shelltype'* *'st'*
  8927. shelltype (st)        number    (default 0)
  8928.             global
  8929.             {not in Vi}
  8930.     On the Amiga this option influences the way how the commands work
  8931.     which use a shell.
  8932.     0 and 1: always use the shell
  8933.     2 and 3: use the shell only to filter lines
  8934.     4 and 5: use shell only for ':sh' command
  8935.     When not using the shell, the command is executed directly.
  8936.  
  8937.     0 and 2: use "shell 'shellcmdflag' cmd" to start external commands
  8938.     1 and 3: use "shell cmd" to start external commands
  8939.  
  8940.                    *'shiftround'* *'sr'* *'noshiftround'* *'nosr'*
  8941. shiftround (sr)        toggle    (default off)
  8942.             global
  8943.             {not in Vi}
  8944.     Round indent to multiple of 'shiftwidth'.  Applies to > and <
  8945.     commands.  CTRL-T and CTRL-D in Insert mode always round the indent to
  8946.     a multiple of 'shiftwidth' (this is vi compatible).
  8947.  
  8948.                         *'shiftwidth'* *'sw'*
  8949. shiftwidth (sw)        number    (default 8)
  8950.             local to buffer
  8951.     Number of spaces to use for each step of (auto)indent.
  8952.  
  8953.                         *'shortmess'* *'shm'*
  8954. shortmess (shm)        string    (default "")
  8955.             global
  8956.             {not in Vi}
  8957.     This option helps to avoid all the "Hit return" messages caused by
  8958.     file messages, for example  with CTRL-G, and to avoid some other
  8959.     messages.  It is a list of flags:
  8960.      flag    meaning when present
  8961.       l    use "999L, 888C" instead of "999 lines, 888 characters"
  8962.       m    use "[+]" instead of "[Modified]"
  8963.       r    use "[RO]" instead of "[readonly]"
  8964.       x    use "[tx]" instead of "[textmode]" and "[notx]" instead of
  8965.         "[notextmode]"
  8966.       f    use "(3 of 5)" instead of "(file 3 of 5)"
  8967.       i    use "[noeol]" instead of "[Incomplete last line]"
  8968.       n    use "[New]" instead of "[New File]"
  8969.       w    use "[w]" instead of "written" for file write message.
  8970.       a    all of the above abbreviations
  8971.  
  8972.       o    overwrite message for writing a file with subsequent message
  8973.         for reading a file (useful for ":wn" or when 'autowrite' on)
  8974.       W    don't give "written" or "[w]" when writing a file
  8975.       s    don't give "search hit BOTTOM, continuing at TOP" or "search
  8976.         hit TOP, continuing at BOTTOM" messages
  8977.       t    trunctate file message at the start if it is too long to fit
  8978.         on the command line, "<" will appear in the left most column.
  8979.     This gives you the opportunity to avoid that a change between buffers
  8980.     requires you to hit return, but still gives as useful a message as
  8981.     possible for the space available.  To get the whole message that you
  8982.     would have got with 'shm' empty, use ":file!"
  8983.     Useful values:
  8984.         shm=    -- No abbreviation of message.
  8985.         shm=a    -- Abbreviation, but no loss of information.
  8986.         shm=at    -- Abbreviation, and truncate message when necessary.
  8987.  
  8988.                  *'shortname'* *'sn'* *'noshortname'* *'nosn'*
  8989. shortname (sn)        toggle    (default off)
  8990.             local to buffer
  8991.             {not in Vi}
  8992.     Filenames are assumed to be 8 characters plus one extension of 3
  8993.     characters.  Multiple dots in file names are not allowed.  When this
  8994.     option is on, dots in filenames are replaced with underscores when
  8995.     adding an extension (".~" or ".swp").  This option is not available
  8996.     for MS-DOS and Win32, because then it would always be on.  This option
  8997.     is useful when editing files on an MS-DOS compatible filesystem, e.g.,
  8998.     messydos or crossdos.
  8999.  
  9000.                         *'showbreak'* *'sbr'*
  9001. showbreak (sbr)        string    (default "")
  9002.             global
  9003.             {not in Vi}
  9004.     String to put at the start of lines that have been wrapped.  Useful
  9005.     values are "> " or "+++ ".  Only printable characters are allowed,
  9006.     excluding <Tab> and comma (in a future version the comma might be used
  9007.     to separate the part that is shown at the end and at the start of a
  9008.     line).
  9009.  
  9010.                      *'showcmd'* *'sc'* *'noshowcmd'* *'nosc'*
  9011. showcmd (sc)        toggle    (default on, off for Unix)
  9012.             global
  9013.             {not in Vi}
  9014.     Show (partial) command in status line.  Set this option off if your
  9015.     terminal is slow.
  9016.  
  9017.                  *'showmatch'* *'sm'* *'noshowmatch'* *'nosm'*
  9018. showmatch (sm)        toggle    (default off)
  9019.             global
  9020.     When a bracket is inserted, briefly jump to the matching one.  The
  9021.     jump is only done if the match can be seen on the screen.
  9022.     A Beep is given if there is no match (no matter if the match can be
  9023.     seen or not).  This option is reset when the 'paste' option is set.
  9024.     When the 'm' flag is not included in 'cpoptions', typing a character
  9025.     will immediately move the cursor back to where it belongs.
  9026.  
  9027.                  *'showmode'* *'smd'* *'noshowmode'* *'nosmd'*
  9028. showmode (smd)        toggle    (default on, off when compiled with COMPATIBLE
  9029.                 defined)
  9030.             global
  9031.     If in Insert, Replace or Visual mode put a message on the last line.
  9032.     Use the 'M' flag in 'highlight' to set the type of highlighting for
  9033.     this message.
  9034.  
  9035.                         *'sidescroll'* *'ss'*
  9036. sidescroll (ss)        number    (default 0)
  9037.             global
  9038.             {not in Vi}
  9039.     The minimal number of columns to scroll horizontally.  Used only when
  9040.     the 'wrap' option is off and the cursor is moved off of the screen.
  9041.     When it is zero the cursor will be put in the middle of the screen.
  9042.     When using a slow terminal set it to a large number or 0.  When using
  9043.     a fast terminal use a small number or 1.  Not used for "zh" and "zl"
  9044.     commands.
  9045.  
  9046.                    *'smartcase'* *'scs'* *'nosmartcase'* *'noscs'*
  9047. smartcase (scs)        toggle    (default off)
  9048.             global
  9049.             {not in Vi}
  9050.     Override the 'ignorecase' option if the search pattern contains upper
  9051.     case characters.  Only used when the search pattern is typed and
  9052.     'ignorecase' option is on.  Used for the commands "/", "?", "n", "N",
  9053.     ":g" and ":s".  Not used for "*", "#", "gd", tag search, etc..
  9054.  
  9055.                  *'smartindent'* *'si'* *'nosmartindent'* *'nosi'*
  9056. smartindent (si)    toggle    (default off)
  9057.             local to buffer
  9058.             {not in Vi}
  9059.             {Only included when compiled with SMARTINDENT defined,
  9060.             check with ":version"}
  9061.     Do smart autoindenting when starting a new line.  Works best for C
  9062.     programs, but can also be used for other languages.  'cindent' does
  9063.     something like this, works better in most cases, but is more strict,
  9064.     see |C_indenting|.  When 'cindent' is on setting 'si' has no effect.
  9065.     Normally 'autoindent' should also be on when using 'smartindent'.
  9066.     An indent is automatically inserted:
  9067.     - After a line ending in '{'.
  9068.     - After a line starting with a keyword from 'cinwords'.
  9069.     - Before a line starting with '}' (only with the "O" command).
  9070.     When typing '}' as the first character in a new line, that line is
  9071.     given the same indent as the matching '{'.
  9072.     When typing '#' as the first character in a new line, the indent for
  9073.     that line is removed, the '#' is put in the first column.  The indent
  9074.     is restored for the next line.  If you don't want this, use this
  9075.     mapping: ":inoremap # X^H#", where ^H is entered with CTRL-V CTRL-H.
  9076.     When using the ">>" command, lines starting with '#' are not shifted
  9077.     right.
  9078.     'smartindent' is reset when the 'paste' option is set.
  9079.  
  9080.                  *'smarttab'* *'sta'* *'nosmarttab'* *'nosta'*
  9081. smarttab (sta)        toggle    (default off)
  9082.             global
  9083.             {not in Vi}
  9084.     When on, a <Tab> in front of a line inserts 'shiftwidth' positions,
  9085.     'tabstop' in other places.  When off a <Tab> always inserts 'tabstop'
  9086.     positions, 'shiftwidth' is only used for ">>" and the like.  See also
  9087.     section 4.3.4 |ins_expandtab|.
  9088.  
  9089.                    *'splitbelow'* *'sb'* *'nosplitbelow'* *'nosb'*
  9090. splitbelow (sb)        toggle    (default off)
  9091.             global
  9092.             {not in Vi}
  9093.     When on, spliting a window will put the new window below the current
  9094.     one.
  9095.  
  9096.                *'startofline'* *'sol'* *'nostartofline'* *'nosol'*
  9097. startofline (sol)    toggle    (default on)
  9098.             global
  9099.             {not in Vi}
  9100.     When on the commands listed below move the cursor to the first
  9101.     blank of the line.  When off the cursor is kept in the same column
  9102.     (if possible).  This applies to the commands: CTRL-D, CTRL-U, CTRL-B,
  9103.     CTRL-F, "G", "H", "M", "L", , and to the commands "d", "<<" and ">>"
  9104.     with a linewise operator and with "%" with a count.  This option is
  9105.     set when the 'compatible' option is set.
  9106.  
  9107.                         *'suffixes'* *'su'*
  9108. suffixes (su)        string    (default ".bak,~,.o,.h,.info,.swp")
  9109.             global
  9110.             {not in Vi}
  9111.     Files with these suffixes are ignored when multiple files match a
  9112.     wildcard.  See |suffixes|.  Commas can be used to separate the
  9113.     suffixes.  Spaces after the comma are ignored.  A dot is also seen as
  9114.     the start of a suffix.  To include a dot or comma in a suffix, precede
  9115.     it with a backslash (see |option_backslash| about including spaces and
  9116.     backslashes).
  9117.  
  9118.                         *'swapsync'* *'sws'*
  9119. swapsync (sws)        string    (default "fsync")
  9120.             global
  9121.             {not in Vi}
  9122.     When this option is not empty a swap file is synced to disk after
  9123.     writing to it.  This takes some time, especially on busy unix systems.
  9124.     When this option is empty parts of the swap file may be in memory and
  9125.     not written to disk.  When the system crashes you may lose more work.
  9126.     On Unix the system does a sync now and then without Vim asking for it,
  9127.     so the disadvantage of setting this option off is small.  On some
  9128.     systems the swap file will not be written at all.  For a unix system
  9129.     setting it to "sync" will use the sync() call instead of the default
  9130.     fsync(), which may work better on some systems.
  9131.  
  9132.                     *'tabstop'* *'ts'*
  9133. tabstop (ts)        number    (default 8)
  9134.             local to buffer
  9135.     Number of spaces that a <Tab> in the file counts for.  (See also
  9136.     ":retab" command in 11.3 |:retab|).
  9137.  
  9138.                         *'taglength'* *'tl'*
  9139. taglength (tl)        number    (default 0)
  9140.             global
  9141.     If non-zero, tags are significant up to this number of characters.
  9142.  
  9143.                  *'tagrelative'* *'tr'* *'notagrelative'* *'notr'*
  9144. tagrelative (tr)    toggle    (default on, off when compiled with COMPATIBLE
  9145.                 defined)
  9146.             global
  9147.             {not in Vi}
  9148.     If on and using a tag file in another directory, file names in that
  9149.     tag file are relative to the directory where the tag file is.  When
  9150.     the 'compatible' option is set, this option is reset.
  9151.  
  9152.                         *'tags'* *'tag'*
  9153. tags (tag)        string    (default "./tags,tags", when compiled with
  9154.                 Emacs tags enabled: "./tags,./TAGS,tags,TAGS")
  9155.             global
  9156.     Filenames for the tag command, separated by spaces or commas.  To
  9157.     include a space or comma in a filename, precede it with a backslash
  9158.     (see |option_backslash| about including spaces and backslashes).
  9159.     When a file name starts with "./", the '.' is replaced with the path
  9160.     of the current file.  Environment variables are expanded |:set_env|.
  9161.     Also see |tags_option|.
  9162.     When Vim was compiled with EMACS_TAGS defined Emacs-style tag files
  9163.     are also supported.  They are automatically recognized.  The default
  9164.     value becomes "./tags,./TAGS,tags,TAGS".  If ":version" shows
  9165.     "+emacs_tags" then the Emacs tags support is included.  {Vi: default
  9166.     is "tags /usr/lib/tags"}
  9167.  
  9168.                         *'term'*
  9169. term            string    (default is $TERM, if that fails:
  9170.                      on Unix: "ansi"
  9171.                         on Amiga: "amiga"
  9172.                        on MS-DOS: "pcterm"
  9173.                          on OS/2: "os2ansi"
  9174.                        on Win 32: "win32")
  9175.             global
  9176.     Name of the terminal.  Used for choosing the terminal control
  9177.     characters.  Environment variables are expanded |:set_env|.
  9178.     For example:
  9179.         :set term=$TERM
  9180.     See |termcap|.
  9181.  
  9182.                         *'terse'* *'noterse'*
  9183. terse            toggle    (default off)
  9184.             global
  9185.             {not in Vi}
  9186.     When set: Add 's' flag to 'shortmess' option (this makes the message
  9187.     for a search that hits the start or end of the file not being
  9188.     displayed).  When reset: Remove 's' flag from 'shortmess' option.  {Vi
  9189.     shortens a lot of messages}
  9190.  
  9191.                    *'textauto'* *'ta'* *'notextauto'* *'nota'*
  9192. textauto (ta)        toggle    (default on, off when compiled with COMPATIBLE
  9193.                 defined)
  9194.             global
  9195.             {not in Vi}
  9196.     When starting to edit a file a check is done for the line separator.
  9197.     If all lines end in <CR><NL> 'textmode' is set, otherwise 'textmode'
  9198.     is reset.  When reading a file, the same is done, but this happens
  9199.     like 'textmode' has been set appropriately for that file only, the
  9200.     option is not changed.  See |textmode_io|.
  9201.  
  9202.                    *'textmode'* *'tx'* *'notextmode'* *'notx'*
  9203. textmode (tx)        toggle    (MS-DOS, Win32 and OS/2: default on, others:
  9204.                 default off)
  9205.             local to buffer
  9206.             {not in Vi}
  9207.     When off, <NL> separates lines.  When on, <CR><NL> separates lines
  9208.     and CTRL-Z at end of file is ignored.  Only used when reading and
  9209.     writing files.  Set automatically when starting to edit a file and
  9210.     'textauto' is on.  See |textmode_io|.
  9211.  
  9212.                         *'textwidth'* *'tw'*
  9213. textwidth (tw)        number    (default 0)
  9214.             local to buffer
  9215.             {not in Vi}
  9216.     Maximum width of text that is being inserted.  A longer line will be
  9217.     broken after white space to get this width.  A zero value disables
  9218.     this.  'textwidth' is set to 0 when the 'paste' option is set.  When
  9219.     'textwidth' is zero, 'wrapmargin' may be used.  See also
  9220.     'formatoptions' and |ins_textwidth|.
  9221.  
  9222.                  *'tildeop'* *'top'* *'notildeop'* *'notop'*
  9223. tildeop (top)        toggle    (default off)
  9224.             global
  9225.             {not in Vi}
  9226.     When on: The tilde command "~" behaves like an operator.
  9227.  
  9228.                 *'timeout'* *'to'* *'notimeout'* *'noto'*
  9229. timeout    (to)        toggle (default on)
  9230.             global
  9231.                         *'ttimeout'* *'nottimeout'*
  9232. ttimeout        toggle (default off)
  9233.             global
  9234.             {not in Vi}
  9235.     These two options together determine the behaviour when part of a
  9236.     mapped key sequence or keyboard code has been received:
  9237.  
  9238.     timeout        ttimeout    action
  9239.     off        off        no time out
  9240.     on        on or off    time out on :mappings and key codes
  9241.     off        on        time out on key codes
  9242.  
  9243.     If there is no time out, Vim will wait until either the complete
  9244.     mapping or key sequence has been received, or it is clear that there
  9245.     is no mapping or key sequence for the received characters.  For
  9246.     example: if you have mapped "vl" and Vim has received 'v', the next
  9247.     character is needed to see if the 'v' is followed by an 'l'.  With a
  9248.     time out Vim will wait for about 1 second for the next character to
  9249.     arrive.  After that the already received characters are interpreted
  9250.     as single characters.  The waiting time can be changed with the
  9251.     'timeoutlen' option.
  9252.     On slow terminals or very busy systems time out may cause
  9253.     malfunctioning cursor keys.  If both options are off, Vim waits
  9254.     forever after an entered <Esc> if there are key codes that start
  9255.     with <Esc>.  You will have to type <Esc> twice.  If you do not have
  9256.     problems with key codes, but would like to have :mapped key
  9257.     sequences not time out in 1 second, set the ttimeout option and
  9258.     reset the timeout option.
  9259.  
  9260.                         *'timeoutlen'* *'tm'*
  9261. timeoutlen (tm)        number    (default 1000)
  9262.             global
  9263.             {not in all versions of Vi}
  9264.                         *'ttimeoutlen'* *'ttm'*
  9265. ttimeoutlen (ttm)    number    (default -1)
  9266.             global
  9267.             {not in Vi}
  9268.     The time in milliseconds that is waited for a key code or mapped key
  9269.     sequence to complete.  Normally only 'timeoutlen' is used and
  9270.     'ttimeoutlen' is -1.  When a different timeout value for key codes is
  9271.     desired set 'ttimeoutlen' to a non-negative number.
  9272.  
  9273.         ttimeoutlen    mapping delay       key code delay
  9274.                < 0          'timeoutlen'       'timeoutlen'
  9275.               >= 0          'timeoutlen'       'ttimeoutlen'
  9276.  
  9277.     The timeout only happens when the 'timeout' and 'ttimeout' options
  9278.     tell so.  A useful setting would be
  9279.         :set timeout timeoutlen=3000 ttimeoutlen=100
  9280.     (time out on mapping after three seconds, time out on key codes after
  9281.     a tenth of a second).
  9282.  
  9283.                         *'title'* *'notitle'*
  9284. title            toggle    (default off, on when title can be restored)
  9285.             global
  9286.             {not in Vi}
  9287.     When on the title of the window will be set to "VIM - filename",
  9288.     where filename is the name of the file currently being edited.  Only
  9289.     works if the terminal supports setting window titles (currently Amiga
  9290.     console, Unix xterm and iris-ansi).
  9291.                                 *X11*
  9292.     When Vim was compiled with HAVE_X11 defined, the original title will
  9293.     be restored if possible.  The output of ":version" will include "+X11"
  9294.     when HAVE_X11 was defined, otherwise it will be "-X11".  This also
  9295.     works for the icon name |'icon'|.
  9296.     If the title cannot be restored, it is set to "Thanks for flying Vim".
  9297.     You will have to restore the title outside of Vim then.  When using an
  9298.     xterm from a remote machine you can use this command:
  9299.         rsh machine_name xterm -display $DISPLAY &
  9300.     then the WINDOWID environment variable should be inherited and the
  9301.     title of the window should change back to what it should be after
  9302.     exiting Vim (rather than using the "Thanks..." message).
  9303.  
  9304.                                 *'titlelen'*
  9305. titlelen        number    (default 85)
  9306.             global
  9307.             {not in Vi}
  9308.     Gives the percentage of 'columns' to use for the length of the window
  9309.     title.  When the title is longer, only the end of the path name is
  9310.     shown.  A '>' character is used to indicate this.  Using a percentage
  9311.     makes this adapt to the width of the window.  But it won't work
  9312.     perfectly, because the actual number of characters available also
  9313.     depends on the font used and other things in the title bar.  When
  9314.     'titlelen' is zero the full path is used.  Otherwise, values from 1 to
  9315.     30000 can be used.
  9316.  
  9317.                  *'ttybuiltin'* *'tbi'* *'nottybuiltin'* *'notbi'*
  9318. ttybuiltin (tbi)    toggle    (default on)
  9319.             global
  9320.             {not in Vi}
  9321.     When on, the builtin termcaps are searched before the external ones.
  9322.     When off the builtin termcaps are searched after the external ones.
  9323.     When this option is changed, you should set the 'term' option next for
  9324.     the change to take effect, for example:
  9325.         :set notbi term=$TERM
  9326.     See also |termcap|.
  9327.  
  9328.                      *'ttyfast'* *'tf'* *'nottyfast'* *'notf'*
  9329. ttyfast (tf)        toggle    (default off, on when 'term' is xterm, hpterm,
  9330.                     sun-cmd, scren, dtterm or iris-ansi)
  9331.             global
  9332.             {not in Vi}
  9333.     Indicates a fast terminal connection.  More characters will be sent to
  9334.     the screen for redrawing, instead of using insert/delete line
  9335.     commands.  Improves smoothness of redrawing when there are multiple
  9336.     windows and the terminal does not support a scrolling region.
  9337.     Also enables the extra writing of characters at the end of each screen
  9338.     line for lines that wrap.  This helps when using copy/paste with the
  9339.     mouse in an xterm and other terminals.
  9340.  
  9341.                         *'ttyscroll'* *'tsl'*
  9342. ttyscroll (tsl)        number    (default 999)
  9343.             global
  9344.     Maximum number of lines to scroll the screen.  If there are more lines
  9345.     to scroll the window is redrawn.  For terminals where scrolling is
  9346.     very slow and redrawing is not slow this can be set to a small number,
  9347.     e.g., 3, to speed up displaying.
  9348.  
  9349.                         *'ttytype'* *'tty'*
  9350. ttytype    (tty)        string    (default from $TERM)
  9351.             global
  9352.     Alias for 'term', see above.
  9353.  
  9354.                         *'undolevels'* *'ul'*
  9355. undolevels (ul)        number    (default 100, 1000 for Unix and OS/2, 0 when
  9356.                 compiled with COMPATIBLE defined)
  9357.             global
  9358.             {not in Vi}
  9359.     Maximum number of changes that can be undone.  Set to 0 for Vi
  9360.     compatibility: one level of undo and 'u' undoes itself.  Set to a
  9361.     negative number for no undo at all (saves memory).
  9362.  
  9363.                         *'updatecount'* *'uc'*
  9364. updatecount (uc)    number    (default 200, 0 when compiled with COMPATIBLE
  9365.                 defined)
  9366.             global
  9367.             {not in Vi}
  9368.     After typing this many characters the swap file will be written to
  9369.     disk.  When zero no swap file will be created at all (see chapter on
  9370.     recovery |crash_recovery|).  'updatecount' is set to zero by starting
  9371.     Vim with the "-n" option, see |starting|.  When editing in readonly
  9372.     mode this option will be initialized to 10000.  Also see |'swapsync'|.
  9373.  
  9374.                         *'updatetime'* *'ut'*
  9375. updatetime (ut)        number    (default 4000)
  9376.             global
  9377.             {not in Vi}
  9378.     If this many milliseconds nothing is typed the swap file will be
  9379.     written to disk (see chapter on recovery |crash_recovery|).
  9380.  
  9381.                     *'viminfo'* *'vi'*
  9382. viminfo (vi)        string    (default "")
  9383.             global
  9384.             {not in Vi}
  9385.             {only included when Vim was compiled with VIMINFO
  9386.             defined, use ":version" to check this}
  9387.     When non-empty, the viminfo file is read upon startup and written
  9388.     when exiting Vim (see |viminfo_file|).  The string should be a comma
  9389.     separated list of parameters, each consisting of a single character
  9390.     identifying the particular parameter, followed by a number or string
  9391.     which specifies the value of that parameter.  If a particular
  9392.     character is left out, then the default value is used for that
  9393.     parameter.  The following is a list characters and their meanings.
  9394.         char     value
  9395.          '    Maximum number of previously edited files for which
  9396.             the marks are remembered.  This parameter must always
  9397.             be included when 'viminfo' is non-empty.
  9398.          f    Whether file marks need to be stored.  If zero, file
  9399.              marks ('0 to '9, 'A to 'Z) are not stored.  When not
  9400.             present or when non-zero, they are all stored.  '0 is
  9401.             used for the current cursor position (when exiting or
  9402.             when doing ":wviminfo").
  9403.          r    Removable media.  The argument is a string (up to the
  9404.             next ',').  This parameter can be given several times.
  9405.             Each specifies the start of a path for which no marks
  9406.             will be stored.  This is to avoid removable media.
  9407.             For MS-DOS you could use "ra:,rb:", for Amiga
  9408.             "rdf0:,rdf1:,rdf2:".  Case is ignored.  Maximum length
  9409.             is 50 characters.
  9410.          "    Maximum number of lines saved for each register.  If
  9411.             zero then registers are not saved.  If no number given
  9412.             all lines are saved.  Dont forget to put a backslash
  9413.             before the ", otherwise it will be recognized as the
  9414.             start of a comment!
  9415.          :    Maximum number of items in the command line history to
  9416.             be saved.  Default: value of 'history'.
  9417.          /    Maximum number of items in the search pattern history
  9418.             to be saved.  If non-zero, then the previous search
  9419.             and substitute patterns are also saved.  Default:
  9420.             value of 'history'.
  9421.     Example:
  9422.         :set viminfo='50,\"1000,:0
  9423.     means that marks will be remembered for the last 50 files you edited,
  9424.     contents of registers (up to 1000 lines each) will be remembered,
  9425.     command line history will not be saved, and since '/' is not
  9426.     specified, the default will be used, that is, save all of the search
  9427.     history, and also the previous search and substitute patterns.
  9428.  
  9429.             *'visualbell'* *'vb'* *'novisualbell'* *'novb'* *beep*
  9430. visualbell (vb)        toggle    (default off)
  9431.             global
  9432.             {not in Vi}
  9433.     Use visual bell instead of beeping.  The terminal code to display the
  9434.     visual bell is given with 't_vb'.  When no beep of flash is wanted,
  9435.     use ":set vb t_vb=".  Does not work on the Amiga, you always get a
  9436.     screen flash.  Also see 'errorbells'.
  9437.  
  9438.                         *'warn'* *'nowarn'*
  9439. warn            toggle    (default on)
  9440.             global
  9441.     Give a warning message when a shell command is used while the buffer
  9442.     has been changed.
  9443.  
  9444.              *'weirdinvert'* *'wiv'* *'noweirdinvert'* *'nowiv'*
  9445. weirdinvert (wiv)    toggle    (default off)
  9446.             global
  9447.             {not in Vi}
  9448.     Set this option for terminals that have a weird inversion method.
  9449.     Makes the start/end invert code outputted before every character.
  9450.     Slows down terminal I/O a lot, but it makes Visual mode work.
  9451.  
  9452.                         *'whichwrap'* *'ww'*
  9453. whichwrap (ww)        string    (default "b,s", "" when compiled with
  9454.                 COMPATIBLE defined)
  9455.             global
  9456.             {not in Vi}
  9457.     Allow specified keys that move the cursor left/right to wrap to the
  9458.     previous/next line when the cursor is on the first/last character in
  9459.     the line.  Concatenate characters to allow this for these keys:
  9460.         char   key      mode
  9461.          b    <BS>     Normal and Visual
  9462.          s    <Space>     Normal and Visual
  9463.          h    "h"     Normal and Visual
  9464.          l    "l"     Normal and Visual
  9465.          <    <Left>     Normal and Visual
  9466.          >    <Right>      Normal and Visual
  9467.          [    <Left>     Insert and Replace
  9468.          ]    <Right>     Insert and Replace
  9469.     For example:
  9470.         ":set ww=<,>,[,]"
  9471.     allows wrap only when cursor keys are used.
  9472.     When the movement keys are used in combination with a delete or change
  9473.     operator, the newline also counts for a character.  This makes "3h"
  9474.     different from "3dh" when the cursor crosses the end of a line.  This
  9475.     is also true for "x" and "X", because they do the same as "dl" and
  9476.     "dh".  If you use this, you may also want to use the mapping
  9477.     ":map <BS> X" to make backspace delete the character in front of the
  9478.     cursor.  When 'compatible' is set, 'whichwrap' is set to "".
  9479.  
  9480.                         *'wildchar'* *'wc'*
  9481. wildchar (wc)        number    (default <Tab>, CTRL-E when compiled with
  9482.                 COMPATIBLE defined)
  9483.             global
  9484.             {not in Vi}
  9485.     Character you have to type to start wildcard expansion in the
  9486.     command line.  CTRL-E is used when the 'compatible' option is set.
  9487.     The character is not recognized when used inside a macro.  Although
  9488.     'wc' is a number option, you can set it to a special key: ":set
  9489.     wc=<Esc>".
  9490.  
  9491.                         *'winheight'* *'wh'*
  9492. winheight (wh)        number    (default 0)
  9493.             global
  9494.             {not in Vi}
  9495.     Minimal number of lines for the current window.  If the current
  9496.     window is smaller, its size is increased, at the cost of the height
  9497.     of other windows.  Set it to 999 to make the current window always
  9498.     fill the screen.  Set it to a small number for normal editing.  The
  9499.     height is not adjusted after one of the commands to change the
  9500.     height of the current window.
  9501.  
  9502.                         *'wrap'* *'nowrap'*
  9503. wrap            toggle    (default on)
  9504.             local to window
  9505.             {not in Vi}
  9506.     When on, lines longer than the width of the window will wrap and
  9507.     displaying continues on the next line.  When off lines will not wrap
  9508.     and only part of long lines will be displayed.  When the cursor is
  9509.     moved to a part that is not shown, the screen will scroll horizontally
  9510.     (also see 'sidescroll' option and |wrap_off|).  If you want to break
  9511.     long lines, see 'textwidth'.
  9512.  
  9513.                         *'wrapmargin'* *'wm'*
  9514. wrapmargin (wm)        number    (default 0)
  9515.             local to buffer
  9516.     Number of characters from the right window border where wrapping
  9517.     starts.  When typing text beyond this limit, a newline will be
  9518.     inserted and inserting continues on the next line.  When 'textwidth'
  9519.     is non-zero, this option is not used.  See also 'formatoptions' and
  9520.     |ins_textwidth|.  {Vi: works differently and less useful}
  9521.  
  9522.                    *'wrapscan'* *'ws'* *'nowrapscan'* *'nows'*
  9523. wrapscan (ws)        toggle    (default on)
  9524.             global
  9525.     Searches wrap around the end of the file.
  9526.  
  9527.                    *'writeany'* *'wa'* *'nowriteany'* *'nowa'*
  9528. writeany (wa)        toggle    (default off)
  9529.             global
  9530.     Allows writing to any file with no need for "!" override.
  9531.  
  9532.                  *'writebackup'* *'wb'* *'nowritebackup'* *'nowb'*
  9533. writebackup (wb)    toggle    (default on, off when compiled with WRITEBACKUP
  9534.                  not defined or COMPATIBLE defined)
  9535.             global
  9536.             {not in Vi}
  9537.     Make a backup before overwriting a file.  The backup is removed after
  9538.     the file was successfully written, unless the 'backup' option is
  9539.     also on.  Reset this option if your file system is almost full.  See
  9540.     the table in section 5.4 for another explanation |backup_table|.
  9541.  
  9542.                         *'writedelay'* *'wd'*
  9543. writedelay (wd)        number    (default 0)
  9544.             global
  9545.             {not in Vi}
  9546.     The number of microseconds to wait for each character sent to the
  9547.     screen.  When non-zero, characters are sent to the terminal one by
  9548.     one.  For MS-DOS pcterm this does not work.  For debugging purposes.
  9549.  
  9550.  
  9551. 20. Terminal information                *terminal_info*
  9552. ========================
  9553.  
  9554. Vim uses information about the terminal you are using to fill the screen and
  9555. recognize what keys you hit.  If this information is not correct the screen
  9556. may be messed up or keys may not be recognized.  The actions which have to be
  9557. performed on the screen are accomplished by outputting a string of
  9558. characters.  Special keys produce a string of characters.  These strings are
  9559. stored in the terminal options, see section 20.2 |terminal_options|.
  9560.  
  9561.  
  9562. 20.1 Startup                        *startup_terminal*
  9563.  
  9564. When Vim is started a default terminal type is assumed.  For the Amiga this is
  9565. a standard CLI window, for MS-DOS the pc terminal, for Unix an ansi terminal.
  9566. A few other terminal types are always available, see below |builtin_terms|.
  9567.  
  9568. You can give the terminal name with the '-T' Vim argument.  If it is not given
  9569. Vim will try to get the name from the TERM environment variable.
  9570.  
  9571.                             *termcap* *terminfo*
  9572. On Unix the terminfo database or termcap file is used.  This is referred to as
  9573. "termcap" in all the documentation.  At compile time, when running configure,
  9574. the choice whether to use terminfo or termcap is done automatically.  When
  9575. running Vim the output of ":version" will show "+terminfo" if terminfo is
  9576. used.  If terminfo is not used "-terminfo" is shown.
  9577.  
  9578. On non-Unix systems a termcap is only available if Vim was compiled with
  9579. TERMCAP defined.
  9580.  
  9581.                             *builtin_terms*
  9582. Which builtin terminals are available depends on a few defines in feature.h,
  9583. which needs to be set at compile time:
  9584.     define        output of ":version"    terminals builtin
  9585. NO_BUILTIN_TCAPS    -builtin_terms        none
  9586. SOME_BUILTIN_TCAPS    +builtin_terms        most common ones (default)
  9587. ALL_BUILTIN_TCAPS    ++builtin_terms        all available
  9588.  
  9589. You can see a list of available builtin terminals with ":set term=xxx".
  9590.  
  9591. If the termcap code is included Vim will try to get the strings for the
  9592. terminal you are using from the termcap file and the builtin termcaps.  Both
  9593. are always used, if an entry for the terminal you are using is present.  Which
  9594. one is used first depends on the 'ttybuiltin' option:
  9595.  
  9596. 'ttybuiltin' on        1: builtin termcap    2: external termcap
  9597. 'ttybuiltin' off    1: external termcap    2: builtin termcap
  9598.  
  9599. If an option is missing in one of them, it will be obtained from the other
  9600. one.  If an option is present in both, the one first encountered is used.
  9601.  
  9602. Which external termcap file is used varies from system to system and may
  9603. depend on the environment variables "TERMCAP" and "TERMPATH".  See "man
  9604. tgetent".
  9605.  
  9606. For normal editing the terminal will be put into "raw" mode.  The strings
  9607. defined with 't_ti' and 't_ks' will be sent to the terminal.  Normally this
  9608. puts the terminal in a state where the termcap codes are valid and activates
  9609. the cursor and function keys.  When Vim exits the terminal will be put back
  9610. into the mode it was before Vim started.  The strings defined with 't_te' and
  9611. 't_ke' will be sent to the terminal.  On the Amiga with commands that execute
  9612. an external command (e.g., "!!") the terminal will be put into Normal mode for
  9613. a moment.  This means that you can stop the output to the screen by hitting a
  9614. printing key.  Output resumes when you hit <BS>.
  9615.  
  9616. Some termcap entries are wrong in the sense that after sending 't_ks' the
  9617. cursor keys send codes different from the codes defined in the termcap.  To
  9618. avoid this you can set 't_ks' (and 't_ke') to empty strings.  This must be
  9619. done during initialization (see 3.4 |initialization|), otherwise its too late.
  9620.  
  9621. Some termcap entries assume that the highest bit is always reset.  For
  9622. example: The cursor-up entry for the amiga could be ":ku=\EA:".  But the Amiga
  9623. really sends "\233A".  This works fine if the highest bit is reset, e.g., when
  9624. using an Amiga over a serial line.  If the cursor keys don't work, try the
  9625. entry ":ku=\233A:".
  9626.  
  9627. Some termcap entries have the entry ":ku=\E[A:".  But the Amiga really sends
  9628. "\233A".  On output "\E[" and "\233" are often equivalent, on input they
  9629. aren't.  You will have to change the termcap entry, or change the key code with
  9630. the :set command to fix this.
  9631.  
  9632. Many cursor key codes start with an <Esc>.  Vim must find out if this a single
  9633. hit of the <Esc> key or the start of a cursor key sequence.  It waits for a
  9634. next character to arrive.  If it does not arrive within one second a single
  9635. <Esc> is assumed.  On very slow systems this may fail, causing cursor keys not
  9636. to work sometimes.  If you discover this problem reset the 'timeout' option.
  9637. Vim will wait for the next character to arrive after an <Esc>.  If you want to
  9638. enter a single <Esc> you must type it twice.  Resetting the 'esckeys' option
  9639. avoids this problems in Insert mode, but you lose the possibility to use
  9640. cursor and function keys in Insert mode.
  9641.  
  9642. On the Amiga the recognition of window resizing is activated only when the
  9643. terminal name is "amiga" or "builtin_amiga".
  9644.  
  9645. Some terminals have confusing codes for the cursor keys.  The televideo 925 is
  9646. such a terminal.  It sends a CTRL-H for cursor-left.  This would make it
  9647. impossible to distinguish a backspace and cursor-left.  To avoid this problem
  9648. CTRL-H is never recognized as cursor-left.
  9649.  
  9650.                     *vt100_cursor_keys* *xterm_cursor_keys*
  9651. Other terminals (e.g., vt100 and xterm) have cursor keys that send <Esc>OA,
  9652. <Esc>OB, etc.  Unfortunately these are valid commands in insert mode: Stop
  9653. insert, Open a new line above the new one, start inserting 'A', 'B', etc.
  9654. Instead of performing these commands Vim will recognize this key sequence as a
  9655. cursor key movement.  To avoid this you could use these settings:
  9656.     :set notimeout        " don't timeout on mappings
  9657.     :set ttimeout        " do timeout on terminal key codes
  9658.     :set timeoutlen=100    " timemout in 100 msec
  9659. This requires the keys to be hit withing 100msec.  When you type you normally
  9660. are not that fast.  The cursor key codes arrive within 100 msec, so they are
  9661. still recognized.
  9662.  
  9663. The default termcap entry for xterm on sun and other platforms does not
  9664. contain the entry for scroll regions.  Add ":cs=\E[%i%d;%dr:" to the xterm
  9665. entry in /etc/termcap and everything should work.
  9666.  
  9667.                             *xterm_end_home_keys*
  9668. On some systems (at least on FreeBSD with X386 3.1.2) the codes that the <End>
  9669. and <Home> keys send contain a <Nul> character.  To make these keys send the
  9670. proper key code, add these lines to your ~/.Xdefaults file:
  9671.  
  9672. *VT100.Translations:        #override \n\
  9673.         <Key>Home: string("0x1b") string("[7~") \n\
  9674.         <Key>End: string("0x1b") string("[8~")
  9675.  
  9676.  
  9677. 20.2 Terminal options                    *terminal_options*
  9678.  
  9679. The terminal options can be set just like normal options.  But they are not
  9680. shown with the ":set all" command.  Instead use ":set termcap".
  9681.  
  9682. It is always possible to change individual strings by setting the
  9683. appropriate option.  For example:
  9684.  
  9685.     :set t_ce=^V^[[K    (CTRL-V, <Esc>, [, K)
  9686.  
  9687. {Vi: no terminal options.  You have to exit Vi, edit the termcap entry and
  9688. try again}
  9689.  
  9690. The options are listed below.  The associated termcap code is always equal to
  9691. the last two characters of the option name.  Two termcap codes are required:
  9692. Cursor positioning and clear screen.
  9693.  
  9694. OUTPUT CODES
  9695.     option    meaning
  9696.  
  9697.     t_AL    add number of blank lines            *t_AL* *'t_AL'*
  9698.     t_al    add new blank line                *t_al* *'t_al'*
  9699.     t_cd    clear to end of screen                *t_cd* *'t_cd'*
  9700.     t_ce    clear to end of line                *t_ce* *'t_ce'*
  9701.     t_cl    clear screen (required!)            *t_cl* *'t_cl'*
  9702.     t_cm    cursor motion (required!)            *t_cm* *'t_cm'*
  9703.     t_CS    if non-empty, cursor relative to scroll region    *t_CS* *'t_CS'*
  9704.     t_cs    define scrolling region                *t_cs* *'t_cs'*
  9705.     t_da    if non-empty, lines from above scroll down    *t_da* *'t_da'*
  9706.     t_db    if non-empty, lines from below scroll up    *t_db* *'t_db'*
  9707.     t_DL    delete number of lines                *t_DL* *'t_DL'*
  9708.     t_dl    delete line                    *t_dl* *'t_dl'*
  9709.     t_ke    out of "keypad transmit" mode            *t_ke* *'t_ke'*
  9710.     t_ks    put terminal in "keypad transmit" mode        *t_ks* *'t_ks'*
  9711.     t_md    bold mode                    *t_md* *'t_md'*
  9712.     t_me    Normal mode (undoes t_mr and t_md)        *t_me* *'t_me'*
  9713.     t_mr    reverse (invert) mode                *t_mr* *'t_mr'*
  9714.                                 *t_ms* *'t_ms'*
  9715.     t_ms    if non-empty, cursor can be moved in standout/inverse mode
  9716.     t_RI    cursor number of chars right            *t_RI* *'t_RI'*
  9717.     t_se    standout end                    *t_se* *'t_se'*
  9718.     t_so    standout mode                    *t_so* *'t_so'*
  9719.     t_sr    scroll reverse (backward)            *t_sr* *'t_sr'*
  9720.     t_te    out of "termcap" mode                *t_te* *'t_te'*
  9721.     t_ti    put terminal in "termcap" mode            *t_ti* *'t_ti'*
  9722.     t_ue    underline end                    *t_ue* *'t_ue'*
  9723.     t_us    underline mode                    *t_us* *'t_us'*
  9724.     t_vb    visual bell                    *t_vb* *'t_vb'*
  9725.     t_ve    cursor visible                    *t_ve* *'t_ve'*
  9726.     t_vi    cursor invisible                *t_vi* *'t_vi'*
  9727.     t_vs    cursor very visible                *t_vs* *'t_vs'*
  9728.     t_ZH    italics mode                    *t_ZH* *'t_ZH'*
  9729.     t_ZR    italics end                    *t_ZR* *'t_ZR'*
  9730.  
  9731. KEY CODES
  9732. Note: Use the <> form if possible
  9733.  
  9734.     option    name        meaning
  9735.  
  9736.     t_ku    <Up>        arrow up            *t_ku* *'t_ku'*
  9737.     t_kd    <Down>        arrow down            *t_kd* *'t_kd'*
  9738.     t_kr    <Right>        arrow right            *t_kr* *'t_kr'*
  9739.     t_kl    <Left>        arrow left            *t_kl* *'t_kl'*
  9740.         <S-Up>        shift arrow up
  9741.         <S-Down>    shift arrow down
  9742.     t_%i    <S-Right>    shift arrow right        *t_%i* *'t_%i'*
  9743.     t_#4    <S-Left>    shift arrow left        *t_#4* *'t_#4'*
  9744.     t_k1    <F1>        function key 1            *t_k1* *'t_k1'*
  9745.     t_k2    <F2>        function key 2             *t_k2* *'t_k2'*
  9746.     t_k3    <F3>        function key 3             *t_k3* *'t_k3'*
  9747.     t_k4    <F4>        function key 4             *t_k4* *'t_k4'*
  9748.     t_k5    <F5>        function key 5             *t_k5* *'t_k5'*
  9749.     t_k6    <F6>        function key 6             *t_k6* *'t_k6'*
  9750.     t_k7    <F7>        function key 7             *t_k7* *'t_k7'*
  9751.     t_k8    <F8>        function key 8             *t_k8* *'t_k8'*
  9752.     t_k9    <F9>        function key 9             *t_k9* *'t_k9'*
  9753.     t_k;    <F10>        function key 10         *t_k;* *'t_k;'*
  9754.     t_F1    <F11>        function key 11         *t_F1* *'t_F1'*
  9755.     t_F2    <F12>        function key 12         *t_F2* *'t_F2'*
  9756.         <S-F1)        shifted function key 1
  9757.         <S-F2>        shifted function key 2
  9758.         <S-F3>        shifted function key 3
  9759.         <S-F4>        shifted function key 4
  9760.         <S-F5>        shifted function key 5
  9761.         <S-F6>        shifted function key 6
  9762.         <S-F7>        shifted function key 7
  9763.         <S-F8>        shifted function key 8
  9764.         <S-F9>        shifted function key 9
  9765.         <S-F10>        shifted function key 10
  9766.         <S-F11>        shifted function key 11
  9767.         <S-F12>        shifted function key 12
  9768.     t_%1    <Help>        help key            *t_%1* *'t_%1'*
  9769.     t_&8    <Undo>        undo key            *t_&8* *'t_&8'*
  9770.     t_kI    <Insert>    insert key            *t_kI* *'t_kI'*
  9771.     t_kD    <Delete>    delete key            *t_kD* *'t_kD'*
  9772.     t_kb    <BS>        backspace key            *t_kb* *'t_kb'*
  9773.     t_kh    <Home>        home key            *t_kh* *'t_kh'*
  9774.     t_@7    <End>        end key                *t_@7* *'t_@7'*
  9775.     t_kP    <PageUp>    page-up key            *t_kP* *'t_kP'*
  9776.     t_kN    <PageDown>    page-down key            *t_kN* *'t_kN'*
  9777.     t_K1    <kHome>        keypad home key            *t_K1* *'t_K1'*
  9778.     t_K4    <kEnd>        keypad end key            *t_K4* *'t_K4'*
  9779.     t_K3    <kPageUp>    keypad page-up key        *t_K3* *'t_K3'*
  9780.     t_K5    <kPageDown>    keypad page-down key        *t_K5* *'t_K5'*
  9781.  
  9782. Note about t_so and t_mr: When the termcap entry "so" is not present the
  9783. entry for "mr" is used.  And vice versa.  The same is done for "se" and "me".
  9784. If your terminal supports both inversion and standout mode, you can see two
  9785. different modes.  If you terminal supports only one of the modes, both will
  9786. look the same.
  9787.  
  9788. If inversion or other highlighting does not work correctly, try setting the
  9789. 'weirdinvert' option.  This makes the start-highlight or end-highlight termcap
  9790. code to be outputted before every character.  This slows down terminal I/O a
  9791. lot, but it makes inversion work on some terminals.
  9792.  
  9793. Some termcaps do not include an entry for 'cs' (scroll region), although the
  9794. terminal does support it.  For example: xterm on a sun.  You can use the
  9795. builtin_xterm or define t_cs yourself.  For example:
  9796.  
  9797.     :set t_cs=^V^[[%i%d;%dr
  9798.  
  9799. Where ^V is CTRL-V and ^[ is <Esc>.
  9800.  
  9801. Unfortunately it is not possible to deduct from the termcap how cursor
  9802. positioning should be done when using a scrolling region: Relative to the
  9803. beginning of the screen or relative to the beginning of the scrolling region.
  9804. Most terminals use the first method.  A known exception is the MS-DOS console
  9805. (pcterm).  The 't_CS' option should be set to any string when cursor
  9806. positioning is relative to the start of the scrolling region.  It should be
  9807. set to an empty string otherwise.  It is default "yes" when 'term' is
  9808. "pcterm".
  9809.  
  9810. Note for xterm users: The shifted cursor keys normally don't work.  You can
  9811.     make them work with the xmodmap command and some mappings in Vim.
  9812.  
  9813.     Give these commands in the xterm:
  9814.         xmodmap -e "keysym Up = Up F13"
  9815.         xmodmap -e "keysym Down = Down F16"
  9816.         xmodmap -e "keysym Left = Left F18"
  9817.         xmodmap -e "keysym Right = Right F19"
  9818.  
  9819.     And use these mappings in Vim:
  9820.         :map <t_F3> <S-Up>
  9821.         :map! <t_F3> <S-Up>
  9822.         :map <t_F6> <S-Down>
  9823.         :map! <t_F6> <S-Down>
  9824.         :map <t_F8> <S-Left>
  9825.         :map! <t_F8> <S-Left>
  9826.         :map <t_F9> <S-Right>
  9827.         :map! <t_F9> <S-Right>
  9828.  
  9829. Instead of, say, <S-Up> you can use any other command that you want to use the
  9830. shift-cursor-up key for.  (Note: To help people that have a Sun keyboard with
  9831. left side keys F14 is not used because it is confused with the undo key; F15
  9832. is not used, because it does a window-to-front; F17 is not used, because it
  9833. closes the window.  On other systems you can probably use them)
  9834.  
  9835.  
  9836. 20.3 Window size                    *window_size*
  9837.  
  9838. [This is about the size of the whole window Vim is using, not a window that is
  9839. created with the :split command]
  9840.  
  9841. If you are running Vim on an Amiga and the terminal name is "amiga" or
  9842. "builtin_amiga", the amiga-specific window resizing will be enabled.  On Unix
  9843. systems three methods are tried to get the window size:
  9844.  
  9845. - an ioctl call (TIOCGSIZE or TIOCGWINSZ, depends on your system)
  9846. - the environment variables "LINES" and "COLUMNS"
  9847. - from the termcap entries "li" and "co"
  9848.  
  9849. If everything fails a default size of 24 lines and 80 columns is assumed.  If
  9850. a window-resize signal is received the size will be set again.  If the window
  9851. size is wrong you can use the 'lines' and 'columns' options to set the
  9852. correct values.
  9853.  
  9854. One command can be used to set the screen size:
  9855.  
  9856.                             *:mod* *:mode*
  9857. :mod[e] [mode]
  9858.  
  9859. Without argument this only detects the screen size.  With MS-DOS it is
  9860. possible to switch screen mode.  [mode] can be one of these values:
  9861.     "bw40"        40 columns black&white
  9862.     "c40"        40 columns color
  9863.     "bw80"        80 columns black&white
  9864.     "c80"        80 columns color (most people use this)
  9865.     "mono"        80 columns monochrome
  9866.     "c4350"        43 or 50 lines EGA/VGA mode
  9867.     number        mode number to use, depends on your video card
  9868.  
  9869.  
  9870. 20.4 Slow and fast terminals            *slow_fast_terminal*
  9871.                         *slow_terminal*
  9872.  
  9873. If you have a fast terminal you may like to set the 'ruler' option.  The
  9874. cursor position is shown in the status line.  If you are using horizontal
  9875. scrolling ('wrap' option off) consider setting 'sidescroll' to a small
  9876. number.
  9877.  
  9878. If you have a slow terminal you may want to reset the 'showcmd' option.
  9879. The command characters will not be shown in the status line.  If the terminal
  9880. scrolls very slowly, set the 'scrolljump' to 5 or so.  If the cursor is moved
  9881. off the screen (e.g., with "j") Vim will scroll 5 lines at a time.  Another
  9882. possibility is to reduce the number of lines that Vim uses with the command
  9883. "z<height><CR>".
  9884.  
  9885. If the characters from the terminal are arriving with more than 1 second
  9886. between them you might want to set the 'timeout' and/or 'ttimeout' option.
  9887. See the "Options" chapter |options|.
  9888.  
  9889. If your terminal does not support a scrolling region, but it does support
  9890. insert/delete line commands, scrolling with multiple windows may make the
  9891. lines jump up and down.  If you don't want this set the 'ttyfast' option.
  9892. This will redraw the window instead of scroll it.
  9893.  
  9894. If your terminal scrolls very slowly, but redrawing is not slow, set the
  9895. 'ttyscroll' option to a small number, e.g., 3.  This will make Vim redraw the
  9896. screen instead of scrolling, when there are more than 3 lines to be scrolled.
  9897.  
  9898. If you are using Vim over a slow serial line, you might want to try running
  9899. Vim inside the "screen" program.  Screen will optimize the terminal I/O quite
  9900. a bit.
  9901.  
  9902. If you are testing termcap options, but you cannot see what is happening,
  9903. you might want to set the 'writedelay' option.  When non-zero, one character
  9904. is sent to the terminal at a time (does not work for MS-DOS).  This makes the
  9905. screen updating a lot slower, making it possible to see what is happening.
  9906.  
  9907.                             *hpterm*
  9908. When you are using an hpterm you probably run into a few problems.  The best
  9909. thing to do is to use an xterm instead.  If you want to use an hpterm for some
  9910. reason, try (re)setting some options:
  9911.     :set    t_sr=
  9912.     :set    t_al=
  9913.     :set    t_dl=
  9914.     :set    ttyfast            redraw screen instead of scrolling
  9915.  
  9916.     :set    weirdinvert        makes highlighting work better, but
  9917.                     slows down screen updating a lot
  9918.  
  9919.  
  9920. 21. Differences from Vi and Ex                *vi_differences*
  9921. ==============================
  9922.  
  9923. Throughout this document differences between Vim and Vi/Ex are given in
  9924. curly braces.  This chapter only lists what has not been mentioned in
  9925. previous chapters.  Also see |vim_diff.txt| for an overview.
  9926.  
  9927.  
  9928. 21.1 Missing commands                    *missing_commands*
  9929.  
  9930. A large number of the "Ex" commands (the commands that start with a colon)
  9931. are included.  However, there is no Ex mode.
  9932.  
  9933. These commands are in Vi, but not in Vim.
  9934.  
  9935. Q            {Vi: go to Ex mode} See |pseudo-Q|.
  9936.  
  9937. :a[ppend]        {Vi: append text}        *:a* *:append*
  9938. :c[hange]        {Vi: replace lines}        *:c* *:change*
  9939. :i[nsert]        {Vi: insert text}        *:i* *:insert*
  9940. :o[pen]            {Vi: start editing in open mode}*:o* *:open*
  9941. :z            {Vi: print some lines}        *:z*
  9942.  
  9943.  
  9944. 21.2 Missing options                    *missing_options*
  9945.  
  9946. These options are in the Unix Vi, but not in Vim.  If you try to set one of
  9947. them you won't get an error message, but the value is not used and cannot be
  9948. printed.
  9949.  
  9950. autoprint (ap)        toggle    (default on)        *'autoprint'* *'ap'*
  9951. beautify (bf)        toggle    (default off)        *'beautify'* *'bf'*
  9952. flash (fl)        toggle    (default ??)        *'flash'* *'fl'*
  9953. graphic (gr)        toggle    (default off)        *'graphic'* *'gr'*
  9954. hardtabs (ht)        number    (default 8)        *'hardtabs'* *'ht'*
  9955.     number of spaces that a <Tab> moves on the display
  9956. mesg            toggle    (default on)        *'mesg'*
  9957. novice            toggle    (default ??)        *'novice'*
  9958. open            toggle    (default on)        *'open'*
  9959. optimize (op)        toggle    (default off)        *'optimize'* *'op'*
  9960. prompt            toggle    (default on)        *'prompt'*
  9961. redraw            toggle    (default off)        *'redraw'*
  9962. slowopen (slow)        toggle    (default off)        *'slowopen'* *'slow'*
  9963. sourceany        toggle    (default off)        *'sourceany'*
  9964. tagstack (tgst)        toggle  (default on)        *'tagstack'* *'tgst'*
  9965.     enables the tagstack and ":pop".
  9966. window (wi)        number    (default 23)        *'window'* *'wi'*
  9967. w300            number    (default 23)        *'w300'*
  9968. w1200            number    (default 23)        *'w1200'*
  9969. w9600            number    (default 23)        *'w9600'*
  9970.  
  9971.  
  9972. 21.3 Limits                        *limits*
  9973.  
  9974. Vim has only a few limits for the files that can be edited {Vi: can not handle
  9975. <Nul> characters and characters above 128, has limited line length, many other
  9976. limits}.
  9977.  
  9978. Maximum line length       On machines with 16-bit ints (Amiga and MS-DOS real
  9979.                mode): 32767, otherwise 2147483647 characters.
  9980.                Longer lines are split.
  9981. Maximum number of lines       2147483647 lines.
  9982. Maximum file size       Only limited by available disk space for the swap
  9983.                file.
  9984. Length of a file name       Unix and Win32: 1024 characters, otherwise 128
  9985.                characters.
  9986. Maximum display width       Unix and Win32: 1024 characters, otherwise 255
  9987.                characters
  9988.  
  9989. Information for undo and registers are kept in memory, thus when making (big)
  9990. changes the amount of (virtual) memory available limits the number of undo
  9991. levels and the text that can be kept in registers.  Other things are also kept
  9992. in memory:  Command line history, error messages for Quickfix mode, etc.
  9993.  
  9994.  
  9995. CONTENTS            *reference_contents* *ref* *reference*
  9996.  
  9997. [Note: The commands for multiple windows and buffers are explained in
  9998. a different file, see |vim_win.txt|]
  9999.  
  10000.  1. Introduction            |intro|
  10001.  2. Notation                |notation|
  10002.  3. Starting Vim            |starting|
  10003.     3.1 Vim arguments            |vim_arguments|
  10004.     3.2 Workbench (Amiga only)        |workbench|
  10005.     3.3 Vim window (Amiga only)        |amiga_window|
  10006.     3.4 Initialization            |initialization|
  10007.     3.5 Suspending                |suspend|
  10008.     3.6 The viminfo file            |viminfo_file|
  10009.  4. Modes                |vim_modes|
  10010.     4.1 Introduction
  10011.     4.2 Switching from mode to mode        |mode_switching|
  10012.     4.3 Insert and Replace mode        |mode_ins_repl|
  10013.         4.3.1 special keys            |ins_special_keys|
  10014.         4.3.2 special special keys        |ins_special_special|
  10015.         4.3.3 'textwidth' option        |ins_textwidth|
  10016.         4.3.4 'expandtab' option        |ins_expandtab|
  10017.         4.3.5 Replace mode            |replace_mode|
  10018.         4.3.6 Insert mode completion        |ins_completion|
  10019.     4.4 Command-line mode            |mode_cmdline|
  10020.         4.4.1 Command line editing        |cmdline_editing|
  10021.         4.4.2 Command line completion        |cmdline_completion|
  10022.         4.4.3 Ex command lines            |cmdline_lines|
  10023.         4.4.4 Ex command line ranges        |cmdline_ranges|
  10024.         4.4.5 Ex special characters        |cmdline_special|
  10025.     4.5 The window contents            |window_contents|
  10026.     4.6 Abbreviations            |abbreviations|
  10027.     4.7 Digraphs                |digraphs|
  10028.     4.8 Using the mouse            |mouse_using|
  10029.     4.9 Online help                |online_help|
  10030.  5. Editing files            |edit_files|
  10031.     5.1 Introduction            |edit_intro|
  10032.     5.2 Editing a file            |edit_a_file|
  10033.     5.3 The argument list            |argument_list|
  10034.     5.4 Writing and quitting        |write_quit|
  10035.     5.5 Using the QuickFix mode        |quickfix|
  10036.     5.6 Editing binary files        |edit_binary|
  10037.     5.7 Automatic commands            |autocommand|
  10038.  6. Cursor motions            |cursor_motions|
  10039.     6.1 Left-right motions            |left_right_motions|
  10040.     6.2 Up-down motions            |up_down_motions|
  10041.     6.3 Word motions            |word_motions|
  10042.     6.4 Text object motions            |object_motions|
  10043.     6.5 Text object selection        |object_select|
  10044.     6.6 Pattern searches            |pattern_searches|
  10045.     6.7 Various motions            |various_motions|
  10046.  7. Scrolling                |scrolling|
  10047.  8. Tags and special searches        |tags_and_searches|
  10048.     8.1 Tags                |tag_commands|
  10049.     8.2 Identifier searches            |include_search|
  10050.  9. Inserting text            |inserting|
  10051. 10. Deleting text            |deleting|
  10052. 11. Changing text            |changing|
  10053.     11.1 Delete and insert            |delete_insert|
  10054.     11.2 Simple changes            |simple_change|
  10055.     11.3 Complex changes            |complex_change|
  10056.     11.4 Formatting text            |formatting|
  10057.     11.5 Formatting C programs        |C_indenting|
  10058. 12. Copying and moving text        |copy_move|
  10059. 13. Visual mode                |Visual_mode|
  10060. 14. Various commands            |various|
  10061. 15. Repeating commands            |repeating|
  10062.     15.1 Single repeats            |single_repeat|
  10063.     15.2 Multiple repeats            |multi_repeat|
  10064.     15.3 Complex repeats            |complex_repeat|
  10065. 16. Undo and redo            |undo_redo|
  10066. 17. Key mapping                |key_mapping|
  10067. 18. Recovery after a crash        |crash_recovery|
  10068.     18.1 The swap file            |swap_file|
  10069.     18.2 Recovery                |recovery|
  10070. 19. Options                |options|
  10071.     19.1 Setting options            |set_option|
  10072.     19.2 Automatically setting options    |auto_setting|
  10073.     19.3 Saving settings            |save_settings|
  10074.     19.4 Options summary            |option_summary|
  10075. 20. Terminal information        |terminal_info|
  10076.     20.1 Startup                |startup|
  10077.     20.2 Terminal options            |terminal_options|
  10078.     20.3 Window size            |window_size|
  10079.     20.4 Slow and fast terminals        |slow_fast_terminal|
  10080. 21. Differences from Vi and Ex        |vi_differences|
  10081.     21.1 Missing commands            |missing_commands|
  10082.     21.2 Missing options            |missing_options|
  10083.     21.3 Limits                |limits|
  10084.  
  10085.  vim:tw=78:ts=8:sw=8:
  10086.