home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-04-23 | 43.5 KB | 1,094 lines |
- Newsgroups: comp.sources.misc
- From: mool@oce.nl (Bram Moolenaar)
- Subject: v37i019: vim - Vi IMitation editor v1.27, Part19/24
- Message-ID: <1993Apr25.013757.23196@sparky.imd.sterling.com>
- X-Md4-Signature: 65c3ac487d38679e2c9aa3a7cd5abe95
- Date: Sun, 25 Apr 1993 01:37:57 GMT
- Approved: kent@sparky.imd.sterling.com
-
- Submitted-by: mool@oce.nl (Bram Moolenaar)
- Posting-number: Volume 37, Issue 19
- Archive-name: vim/part19
- Environment: UNIX, AMIGA, MS-DOS
-
- #! /bin/sh
- # This is a shell archive. Remove anything before this line, then unpack
- # it by saving it into a file and typing "sh file". To overwrite existing
- # files, type "sh file -c". You can also feed this as standard input via
- # unshar, or by typing "sh <file", e.g.. If this archive is complete, you
- # will see the following message at the end:
- # "End of archive 19 (of 23)."
- # Contents: vim/doc/reference.doc3
- # Wrapped by mool@oce-rd2 on Mon Apr 19 15:50:13 1993
- PATH=/bin:/usr/bin:/usr/ucb ; export PATH
- if test -f 'vim/doc/reference.doc3' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'vim/doc/reference.doc3'\"
- else
- echo shar: Extracting \"'vim/doc/reference.doc3'\" \(41128 characters\)
- sed "s/^X//" >'vim/doc/reference.doc3' <<'END_OF_FILE'
- X
- X:![!]{cmd} [!][arg] Execute {cmd} with the shell. The optional bangs are
- X replaced with the previously given command. The
- X optional [arg] is appended. See also the 'shell' and
- X 'shelltype' option.
- X
- X:ve[rsion] Print the version number of the editor.
- X
- XK Run a program to lookup the identifier under the
- X cursor. The name of the program is given with the
- X 'keywordprg' (kp) option. The identifier is formed
- X of letters, numbers and the underscore. The
- X identifier under or right of the cursor is used. The
- X same can be done with the command
- X ":!{program} {identifier}".
- X {not in Vi}
- X
- X
- X 15. Repeating commands
- X
- X15.1 Single repeats
- X
- X. Repeat last change with count replaced by [cnt].
- X
- XSimple changes can be repeated with the '.' command. Without a count, the
- Xcount of the last change is used. If you enter a count, it will replace the
- Xlast one. If the last change included a specification of a numbered
- Xregister, the register number will be incremented. See the section on undo
- Xand redo for an example how to use this.
- X
- X
- X15.2 Multiple repeats
- X
- X:[range]g[lobal]/{pattern}/[cmd]
- X Execute the Ex command [cmd] (default ":p") on the
- X lines within [range] where {pattern} matches.
- X
- X:[range]g[lobal]!/{pattern}/[cmd]
- X Execute the Ex command [cmd] (default ":p") on the
- X lines within [range] where {pattern} does NOT match.
- X
- X:[range]v[global]/{pattern}/[cmd]
- X Same as :g!.
- X
- XThe global commands work by first scanning through the [range] lines and
- Xmarking each line where a match occurs. In a second scan the [cmd] is
- Xexecuted for each marked line with its line number prepended. If a line is
- Xchanged or deleted its mark disappears. The default for [range] is the whole
- Xbuffer (1,$). Use "CTRL-C" to interrupt the command.
- X
- XTo repeat a non-Ex command, you will have to put the command in a file and
- Xuse "source!". For example:
- X :g/pat/so! scriptfile
- XMake sure that the scriptfile ends with a whole command, otherwise Vim will
- Xwait for you to type the rest of the command for each match. The screen will
- Xnot have been updated, so you don't know what you are doing.
- X
- XThe undo/redo command will undo/redo the whole global command at once.
- X
- X
- X15.3 Complex repeats
- X
- Xv<a-zA-Z> Record typed characters into named register <a-zA-Z>
- X (uppercase to append).
- X
- Xv Stops recording. {Vi: no recording}
- X
- X@<a-z> Execute the contents of named register <a-z> [cnt]
- X times.
- X
- X@@ Repeat the previous @<a-z> [cnt] times.
- X
- X:@<a-z> Execute the contents of named register <a-z> as an
- X Ex command. {Vi: only in some versions}
- X
- X:@@ Repeat the previous :@<a-z>. {Vi: only in some
- X versions}
- X
- X:so[urce] {file} Read Ex commands from {file}.
- X
- X:so[urce]! {file} Read VIM commands from {file}. {not in Vi}
- X
- XAll commands and command sequences can be repeated by putting them in a named
- Xregister and then executing it. There are two ways to get the commands in the
- Xregister:
- X- Use the record command. You type the commands once, and while they are
- X being executed they are stored in a register. Easy, because you can see
- X what you are doing. If you make a mistake, 'put' the register into the
- X file, edit the command sequence, and then delete it into the register
- X again. You can continue recording by appending to the register (use an
- X uppercase letter).
- X- Delete or yank the command sequence into the register.
- X
- XOften used command sequences can be put under a function key with the ':map'
- Xcommand.
- X
- XAn alternative is to put the commands in a file, and execute them with the
- X':source!' command. Useful for long command sequences. Can be combined with
- Xthe ':map' command to put complicated commands under a funcion key.
- X
- XThe ':source' command reads Ex commands from a file line by line. You will
- Xhave to type any needed keyboard input. The ':source!' command reads from a
- Xscript file character by character, interpreting each character as if you
- Xtyped it.
- X
- XExample: When you give the ":!ls" command you are asked to "hit return to
- Xcontinue". If you ':source' a file with the line "!ls" in it, you will have
- Xto type the return yourself. But if you ':source!' a file with the line
- X":!ls" in it, the next characters from that file are read until a <CR> is
- Xfound. You will not have to type <CR> yourself, unless ":!ls" was the last
- Xline in the file.
- X
- XIt is possible to put ':source[!]' commands in the script file, so you can
- Xmake a top-down hierachy of script files. The ':source' command can be
- Xnested as deep as the number of files that can be opened at one time (about
- X15). The ':source!' command can be nested up to 15 levels deep.
- X
- XIn script files terminal-dependent key codes are represented by
- Xterminal-independent single character codes:
- X
- X code hex meaning
- X
- X 128 0x80 up-arrow
- X 129 0x81 down-arrow
- X 130 0x82 left-arrow
- X 131 0x83 right-arrow
- X 132 0x84 shift up-arrow
- X 133 0x85 shift down-arrow
- X 134 0x86 shift left-arrow
- X 135 0x87 shift right-arrow
- X
- X 136 0x88 function key 1
- X 137 0x89 function key 2
- X 138 0x8a function key 3
- X 139 0x8b function key 4
- X 140 0x8c function key 5
- X 141 0x8d function key 6
- X 142 0x8e function key 7
- X 143 0x8f function key 8
- X 144 0x90 function key 9
- X 145 0x91 function key 10
- X
- X 146 0x92 shifted function key 1
- X 147 0x93 shifted function key 2
- X 148 0x94 shifted function key 3
- X 149 0x95 shifted function key 4
- X 150 0x96 shifted function key 5
- X 151 0x97 shifted function key 6
- X 152 0x98 shifted function key 7
- X 153 0x99 shifted function key 8
- X 154 0x9a shifted function key 9
- X 155 0x9b shifted function key 10
- X
- X 156 0x9c help key
- X 157 0x9d undo key
- X 158 0x9e CTRL-@
- X
- X
- X 16. Undo and redo
- X
- X<UNDO> or
- Xu Undo [cnt] changes. {Vi: only one level}
- X
- X:u[ndo] Undo one change. {Vi: only one level}
- X
- XCTRL-R Redo [cnt] changes which were undone with 'u'. {Vi:
- X redraw screen}
- X
- XU Undo all latest changes on one line. {Vi: while not
- X moved off of it}
- X
- XThe last changes are remembered. You can go back in time with the 'u'
- Xcommand. You can then go forward again with the 'CTRL-R' command. If you
- Xmake a new change after the 'u' command, the 'CTRL-R' will not be possible
- Xanymore. The number of changes that are remembered is set with the
- X'undolevels' option. If it is zero, the old fashioned Vi undo is present:
- Xone level of undo and undo undoes itself.
- X
- XThe 'U' command is treated by undo/redo just like any other command. Thus a
- X'u' command undos a 'U' command and a 'CTRL-R' command redoes it again. When
- Xmixing 'U', 'u' and 'CTRL-R' you will notice that the 'U' command will
- Xrestore the situation of a line to before the previous 'U' command. This may
- Xbe confusing. Try it out to get used to it.
- X
- XThe numbered registers can also be used for undoing deletes. Each time you
- Xdelete text, it is put into register "1. The contents of register "1 is
- Xshifted to "2, etc. The contents of register "9 is lost. You can now get
- Xback the most recent deleted text with the put command: '"1P'. You can get
- Xback the text of three deletes ago with '"3P'.
- X
- XIf you want to get back more than one part of deleted text, you can use a
- Xspecial feature of the repeat command '.'. It will increase the number of the
- Xregister used. So if you first do '"1P', the following '.' will result in a
- X'"2P'. Repeating this will result in all numbered registers to be inserted.
- X
- XExample: If you deleted text with 'dd....' it can be restored with
- X '"1P....'.
- X
- XIf you don't know in which register the deleted text is, you can use the
- X:display command. An alternative is to try the first register with '"1P', and
- Xif it is not what you want do 'u.'. This will result in the contents of the
- Xfirst put to be removed, and a repeat of the put command for the second
- Xregister. Repeat the 'u.' until you got what you want.
- X
- X
- X 17. Key mapping
- X
- X:map {lhs} {rhs} Map the key sequence {lhs} to {rhs} in normal mode.
- X
- X:map! {lhs} {rhs} Map the key sequence {lhs} to {rhs} in insert and
- X command line mode.
- X
- X:noremap {lhs} {rhs} Map the key sequence {lhs} to {rhs} in normal mode.
- X Disallow remapping of {rhs}. {not in Vi}
- X
- X:noremap! {lhs} {rhs} Map the key sequence {lhs} to {rhs} in insert and
- X command line mode. Disallow remapping of {rhs}. {not
- X in Vi}
- X
- X:unm[ap] {lhs} Remove the mapping of {lhs} for normal mode.
- X
- X:unm[ap]! {lhs} Remove the mapping of {lhs} for insert and command
- X line mode.
- X
- X:map List all key mappings for normal mode.
- X
- X:map! List all key mappings for insert and command line
- X mode.
- X
- X:map {lhs} List the key mappings for the key sequences starting
- X with {lhs} in normal mode.
- X
- X:map! {lhs} List the key mappings for the key sequences starting
- X with {lhs} in insert and command line mode.
- X
- XThese commands are used to map a key or key sequence to a string of
- Xcharacters. You can use this to put command sequences under function keys,
- Xtranslate one key into another, etc. See the "Options" chapter below for how
- Xto save and restore the current mapping.
- X
- XEverything from the first non-blank after {lhs} upto the end of the line (or
- X<|>) is considered to be part of {rhs}. This allows the {rhs} to end with a
- Xspace.
- X
- XTo include a space in {lhs} precede it with a CTRL-V (type two CTRL-Vs for
- Xeach space). If you want a {rhs} that starts with a space, precede {rhs}
- Xwith a single CTRL-V (You have to type CTRL-V two times). You can create an
- Xempty {rhs} by typing nothing after the two CTRL-Vs.
- X
- XIt is not possible to put a comment after this command, because the <">
- Xcharacter is considered to be part of the {rhs}. To put a <|> in {rhs}
- Xescape it with a backslash or a CTRL-V (to get one CTRL-V you have to type
- Xit twice).
- X
- XTo avoid mapping of the characters you type in insert or comand line mode,
- Xtype a CTRL-V first.
- X
- XNote that the second character (argument) of the commands @zZtTfF[]rm'`"v is
- Xnot mapped. This was probably done to be able to use all the named registers
- Xand marks, even when the command with the same name has been mapped.
- X
- XSome examples (given as you type them; e.g. the "^V" is CTRL-V which you
- Xtype, but will not show up on the screen):
- X
- X :map g /foo^V^Mcwbar^V^[ (replace next "foo" by "bar")
- X :map! qq quadrillion questions
- X
- XVim will compare what you type with the start of a mapped sequence. If there
- Xis an incomplete match, it will get more characters until there either is a
- Xcomplete match or until there is no match at all. Example: If you map! "qq",
- Xthe first <q> will not appear on the screen until you type another
- Xcharacter. This is because Vim cannot know if the next character will be a
- X<q> or not. If you set the 'timeout' option (which is the default) Vim will
- Xonly wait for one second. After that it assumes that the "q" is to be
- Xinterpreted as such. If type slowly, or your system is slow, reset the
- X'timeout' option. Then you might want to set the 'ttimeout' option. See the
- X"Options" chapter.
- X
- XIf you want to exchange the meaning of two keys you should use the :noremap
- Xcommand. For example:
- X :noremap k j
- X :noremap j k
- XThis will exchange the cursor up and down commands. With the normal :map
- Xcommand, when the 'remap' option is set, mapping takes place until the text
- Xis found not to be a part of a {lhs}. For example, if you use:
- X :map x y
- X :map y x
- XVim will replace x by y, and then y by x, etc. When this has happened 1000
- Xtimes, Vim will give an error message.
- X
- XSee the file "index" for keys that are not used and thus can be mapped
- Xwithout loosing any builtin function.
- X
- X
- X 18. Recovery after a crash.
- X
- XYou have spent several hours typing in that text that has to be finished
- Xnext morning, and then disaster strikes: Your computer crashes.
- X
- X DON'T PANIC!
- X
- X
- X18.1 The autoscript file
- X
- XVim keeps track of everything you type. Using the original file you started
- Xfrom and the autoscript file you can recover (almost) all of your work.
- X
- XThe name of the autoscript file is the same as the file you are editing,
- Xwith the extension ".vim". On MSDOS machines and when the 'shortname' option
- Xis set, any '.' is replaced by '_'. If this file already exists (e.g. when
- Xyou are recovering from a crash) a warning is given and another extention is
- Xused, ".vil", ".vik", etc. An existing file will never be overwritten. The
- Xfile is deleted as soon as the edited text is successfully written to disk.
- X
- XTechnical: The replacement of '.' by '_' is done to avoid problems with
- X MSDOS compatible filesystems (e.g. crossdos, multidos). If Vim is
- X able to detect that the file is on an MSDOS-like filesystem, a
- X flag is set that has the same effect as the 'shortname' option.
- X This flag is reset when you start editing another file.
- X
- X If the ".vim" filename already exists, the last character is
- X decremented until there is no file with that name or ".via" is
- X reached. In the last case, no autoscript file is created.
- X
- XBy setting the 'directory' option you can place the file in another
- Xplace than where the edited file is. It is adviced to put the autoscript
- Xfiles on a "scratch" partition. This reduces the risc of damaging the
- Xpartition where the edited file is. You can also use a recoverable ram disk,
- Xbut there is no 100% guarantee that this works. Putting it in RAM: makes no
- Xsense, you will loose it in a crash. Put a command resembling the following
- Xone in s:.exrc:
- X :set dir=dh2:tmp/
- XThis is also very handy when editing files on floppy.
- X
- XThe autoscript file is updated after typing 100 characters or when you have
- Xnot typed anything for two seconds. This only happens if the buffer was
- Xchanged, not when you only moved around. The reason why it is not kept up to
- Xdate all the time is that this would slow down normal work too much. You can
- Xchange the 100 character count with the 'updatecount' option. You can set
- Xthe time with the 'updatetime' option. The time is given in milliseconds.
- X
- XIf the writing to the autoscript file is not wanted, it can be switched off
- Xby setting the 'updatecount' option to 0. The same is done when starting Vim
- Xwith the "-n" or "-v" option. Writing can be switched back on by setting the
- X'updatecount' option to non-zero. If you have changed the buffer when
- Xswitching on, the autoscript file will be incomplete and recovery will
- Xprobably fail. To avoid this write out the buffer with ":w" before switching
- Xon the autoscript file.
- X
- X
- X18.2 Recovery
- X
- XIn most cases recovery is quite easy: start Vim on the same file you were
- Xediting when the crash happened, with the "-r" option added. Vim will start
- Xediting the file using the key strokes in the autoscript file. Be sure that
- Xthe recovery was successful before overwriting the original file or deleting
- Xthe autoscript file.
- X
- XExample: vim -r reference.doc
- X
- XImportant: The .exrc file must be the same as with the original edit session,
- Xbecause some options have effect on the editing. Also the window size must be
- Xexactly the same, because the cursor movement resulting from some commands
- Xdepends on the window size (e.g. CTRL-F). To help you with that the window
- Xresizing events are written into the script file with ":winsize" commands.
- XThe result of this command is that Vim will resize the used part of the
- Xwindow, but the window itself will remain the same size. The commands will
- Xbe executed correctly, but the window contents may look disturbed. During
- Xnormal editing you should not use the ":winsize" command. Use the window
- Xresizing gadget in the lower right corner of the window. Do not resize the
- Xwindow during recovery!
- X
- XIn some cases the "-r" option does not result in successful recovery. This
- Xhappens when you executed a command that cannot be reproduced anymore. For
- Xexample: Reading a file which does not exist anymore. In such a case the
- Xsucceeding commands probably only make things worse. To solve this you will
- Xhave to edit the autoscript file and remove the commands that cause errors.
- XIf this becomes difficult try splitting up the autoscript file in small
- Xpieces. {Vi: recovers in another way that has a larger change to succeed but
- Xcauses more overhead}
- X
- XIf the autoscript file is not ending in ".vim" but in something else, you can
- Xuse the script reading option "-s {filename}". This will have (almost) the
- Xsame effect as the "-r" option. This is also handy when the script file is
- Xin another directory than expected.
- X
- XYou can give the "-r" option in combination with the "-s scriptin" option.
- XThe scriptin file will be read first, then the autoscript file for recovery.
- X
- XThe difference between using the "-r" option and the "-s" option is that with
- Xthe "-r" option the name of the script file is made from the file name, and
- Xthe last modification date is checked to see if the autoscript file is
- Xnewer. This prevents the wrong autoscript file to be used for a recovery.
- X
- X
- X 19. Options
- X
- XVi has a number of internal variables and switches which can be set to
- Xachieve special effects. These options come in three forms, those that are
- Xswitches, which toggle from off to on and back, those that require a numeric
- Xvalue, and those that require an alphanumeric string value.
- X
- X
- X19.1 Setting options
- X
- X:se[t] Show all modified options. {Vi: non-default options}
- X
- X:se[t] all Show all but terminal options.
- X
- X:se[t] termcap Show all terminal options.
- X
- X:se[t] {option} Set toggle option on, show value of string or number
- X option.
- X
- X:se[t] no{option} Set toggle option off.
- X
- X:se[t] inv{option} Invert toggle option. {not in Vi}
- X
- X:se[t] {option}={value} Set string or number option to {value}.
- X
- X:se[t] {option}? Show value of {option}.
- X
- XThe arguments to ":set" may be repeated. For example:
- X":set ai nosi sw=3 ts=3". If you make an error in one of the arguments an
- Xerror message will be given and the text upto the next space will be
- Xskipped. Thus following arguments will be processed.
- X
- XBesides changing options with the ":set" command, there are four
- Xalternatives to set options automatically for one or more files. The first
- Xand second ones are used for all files. The third is used to set options for
- Xthe files in one directory. The last is used to set options for a single
- Xfile. The first three are done when you start VIM, in the given order. The
- Xlast is done whenever you start editing a new file.
- X
- X1. The environment variable VIMINIT is read for an Ex command. You can set
- X VIMINIT to something like "set noai sw=3" to set options.
- X2. Only if there is no VIMINIT environment variable, the file
- X "s:.vimrc" is read for Ex commands. You can include set commands in this
- X file. (see below for how to automatically create a file with set commands).
- X3. If VIMINIT is not found and "s:.vimrc" does not exist, EXINIT is used,
- X in the same way as VIMINIT.
- X4. If VIMINIT is not found, "s:.vimrc" does not exist and EXINIT is not found,
- X the file "s:.exrc" is read for Ex commands.
- X5. The file ".vimrc" in the current directory is read for Ex commands. You
- X can include set commands in this file. If this file is not found the file
- X ".exrc" is tried.
- X6. If you start editing a new file, a number of lines at the beginning and
- X end of the file are checked for the string "vi:" or "ex:". The text after
- X it is considered to be the arguments for a ":set" command, separated with
- X colons. For example: "vi:noai:sw=3".
- X How many lines are checked depends on the 'modelines' option.
- X The string "vi:" or "ex:" must be preceded with a blank or begin at the
- X start of a line. This minimizes the chance that a normal word like "lex:"
- X is catched. Note that all of the rest of the line is used, thus a line
- X like: "/* vi:ts=4: */" will give an error message for the trailing "*/".
- X
- X
- X19.2 Saving settings
- X
- X:mkexrc [file] Write current key mappings and changed options to
- X [file] (default ".exrc"), unless it already exists.
- X {not in Vi}
- X
- X:mkexrc! [file] Always write current key mappings and changed
- X options to [file] (default ".exrc"). {not in Vi}
- X
- X:mkvimrc[!] [file] Same as :mkexrc, but default is ".vimrc". {not in
- X Vi}
- X
- XThese commands will write ":map" and ":set" commands to a file, in such a
- Xway that when these commands are executed, the current key mappings and
- Xoptions will be set again. A common method is to use a default ".exrc" file
- Xby first reading one in with ":source s:.exrc.Cprogs", change the settings
- Xand then save them in the current directory with ":mkexrc!".
- X
- X
- X19.3 Options summary
- X
- XIn the list below all the options are mentioned with their full name and some
- Xwith an abbreviation between brackets. Both forms may be used.
- X
- Xautoindent (ai) toggle (default off)
- X Copy indent from current line when starting a new line (typing <CR>
- X in insert mode or when using the 'o' or 'O' command). If you do not
- X type anything on the new line except <BS> and then type <ESC> or
- X <CR>, the indent is deleted again. When autoindent is set,
- X formatting (with the 'V' command or when you reach 'textwidth' in
- X insert mode) uses the indent of the first line.
- X
- Xautowrite (aw) toggle (default off)
- X Write the contents of the file, if it has been modified, on each
- X :next, :rewind, :previous, :stop, :tag, :!, CTRL-] and CTRL-^
- X command.
- X
- Xbackspace (bs) number (default 0)
- X Influences the working of <BS>, <DEL>, CTRL-W and CTRL-U in insert
- X mode. If set to 0 Vi compatible backspacing is used. When 1 allow
- X backspacing over newlines. When larger than 1 allow backspacing over
- X the start of insert. In the last case CTRL-W and CTRL-U stop once at
- X the start of insert. {not in Vi}
- X
- Xbackup (bk) toggle (default on)
- X Make a backup before overwriting a file. Leave it around after the
- X file has been succesfully written. If you do not want to keep the
- X backup file, but you do want a backup while it is being written, use
- X the 'writebackup' option. If you do not want a backup file at all
- X reset both options. {not in Vi}
- X
- Xbackupdir (bdir) string (default "~/")
- X For Unix systems only. Name of the directory where the backup file
- X is put when it cannot be created in the same directory as the
- X original file. {not in Vi}
- X
- Xcolumns number (default 80)
- X Number of columns in the display. Normally this is set by the
- X terminal initialization and does not have to be set by hand. {not in
- X Vi}
- X
- Xcompatible (cp) toggle (default off)
- X At the moment this option is set, several other options will be set
- X or reset to make Vim vi-compatible. Switching this option off has no
- X effect. {not in Vi}
- X
- X option new value effect
- X
- X backspace 0 normal backspace
- X backup off no backup file
- X digraph off no digraphs
- X expandtab off tabs not expanded to spaces
- X history 0 no commandline history
- X insertmode off do not start in insert mode
- X joinspaces on insert 2 spaces after period
- X modelines 0 no modelines
- X repdel on in replace mode del deletes a char
- X ruler off no ruler
- X scrolljump 0 no jump scroll
- X shiftround off indent not rounded to shiftwidth
- X showcommand off command characters not shown
- X showmode off current mode not shown
- X smartindent off no smart indentation
- X textwidth 9999 maximum text width
- X tildeop off tilde is not an operator
- X ttimeout off no terminal timeout
- X undolevels 0 no multilevel undo
- X updatecount 0 no autoscript file
- X writebackup off no backup file written
- X yankendofline off do not Yank to end of line
- X
- Xdigraph (dg) toggle (default off)
- X Enable the entering of digraphs in input mode with {char1} <BS>
- X {char2}. Only works if Vim was compiled with digraphs enabled. {not
- X in Vi}
- X
- Xdirectory (dir) string (default "")
- X Directory for the autoscript file. Empty means in same directory as
- X the edited file. The name must end in an ':' or '/'. {Vi: directory
- X to put temp file in, defaults to "/tmp"}
- X
- Xequalprg (ep) string (default "indent")
- X External program to use for '=' command. {not in Vi}
- X
- Xerrorbells (eb) toggle (default off)
- X Ring the bell for error messages. Does not work on the Amiga, you
- X always get a screen flash.
- X
- Xerrorfile (ef) string (default "AztecC.Err")
- X Name of the error file for the QuickFix option (see 5.5). {not in
- X Vi}
- X
- Xexpandtab (et) toggle (default off)
- X In insert mode: Use the appropriate number of spaces to insert a
- X <TAB>. {not in Vi}
- X
- Xgraphic (gr) toggle (default off, MSDOS: on)
- X When off characters between '~' and 0xa0 are displayed as "~?",
- X "~@", "~A", etc.. When on the characters are sent to the display
- X directly. This will allow for graphic characters to be shown on some
- X terminals (e.g. MSDOS console) and mess up the display on others
- X (e.g. Amiga).
- X
- Xhelpfile (hf) string (default "vim:vim.hlp")
- X Name of the help file. It may start with an environment variable.
- X For example: "$VIM/doc/vim.hlp". {not in Vi}
- X
- Xhistory (hi) number (default 20)
- X Number of command lines that are remembered. {not in Vi}
- X
- Xignorecase (ic) toggle (default off)
- X Ignore case in search patterns.
- X
- Xinsertmode (im) toggle (default off)
- X Start the edit of a file in insert mode. {not in Vi}
- X
- Xjoinspaces (js) toggle (default on)
- X Insert two spaces after a period with a join command. {not in Vi}
- X
- Xkeywordprg (kp) string (default "ref")
- X Program to use for the 'K' command. {not in Vi}
- X
- Xlines number (default 25)
- X Number of lines in the display. Normally you don't need to set this.
- X That is done automatically by the terminal initialization code.
- X
- Xlist toggle (default off)
- X List mode: Show tabs as CTRL-I, show end of line with $. Useful to
- X see the difference between tabs and spaces and for trailing blanks.
- X
- Xmagic toggle (default on)
- X Changes the special characters that can be used in search patterns.
- X See section "Pattern searches".
- X
- Xmodelines (ml) number (default 5)
- X The number of lines that is checked for set commands. See 19.1. {not
- X in Vi}
- X
- Xnumber (nu) toggle (default off)
- X Print the line number in front of each line.
- X
- Xparagraphs (para) string (default "IPLPPPQPP LIpplpipbp")
- X Specifies the nroff macros that separate paragraphs. These are pairs
- X of two letters.
- X
- Xreadonly (ro) toggle (default off)
- X If set, writes fail unless you use an !. Affects anything that writes
- X to protect you from accidental overwriting a file. Default on when
- X vim is started in view mode ("vim -v").
- X
- Xremap toggle (default on)
- X Allows for :map command to work recursively. If you do not want this
- X for a single entry, use the :noremap command.
- X
- Xrepdel (rd) toggle (default on)
- X When on, <DEL>, <BS>, CTRL-W and CTRL-U in replace mode delete
- X characters. When off, only the cursor is moved, and no characters
- X are deleted. {not in Vi}
- X
- Xreport number (default 2)
- X Threshold for reporting number of lines changed.
- X
- Xruler (ru) toggle (default off)
- X Show the line number and column of the cursor in the status line,
- X separated by a comma. {not in Vi}
- X
- Xscroll number (default 12)
- X Number of lines to scroll with CTRL-U and CTRL-D commands.
- X
- Xscrolljump number (default 1)
- X Minimal number of lines to scroll when the cursor gets off the
- X screen (e.g. with 'j'). Not used for scroll commands (e.g. CTRL-E,
- X CTRL-D). Useful if your terminal scrolls very slow. {not in Vi}
- X
- Xsections string (default "SHNHH HUnhsh")
- X Specifies the nroff macros that separate sections. These are pairs of
- X two letters.
- X
- Xshell (sh) string (default "sh", MSDOS: "command")
- X Name of the shell to use for ! and :! commands. See also the
- X 'shelltype' option. It is allowed to give an argument to the
- X command, e.g. "csh -f". If you type this in the command line you
- X will have to put a backslash in front of the space.
- X
- Xshelltype (st) number (default 0)
- X On the Amiga this option influences the way how the commands work
- X which use a shell.
- X 0 and 1: always use the shell
- X 2 and 3: use the shell only to filter lines
- X 4 and 5: use shell only for ':sh' command
- X When not using the shell, the command is executed directly.
- X
- X 0 and 2: use 'shell -c cmd' to start external commands
- X 1 and 3: use 'shell cmd' to start external commands
- X
- Xshiftround (sr) toggle (default off)
- X Round indent to multiple of shiftwidth. Applies to > and < commands
- X and to CTRL-T and CTRL-D in insert mode. {not in Vi}
- X
- Xshiftwidth (sw) number (default 8)
- X Number of spaces to use for (auto)indent.
- X
- Xshortname (sn) toggle (default off)
- X Filenames can be 8 characters plus one extention of 3 characters.
- X Multiple dots in file names are not allowed. When this option is on,
- X dots in filenames are replaced by underscores when adding an
- X extention (".bak" or ".vim"). This option is not available for
- X MSDOS, because then it would always be on. This option is useful
- X when editing files on an MSDOS compatible filesystem, e.g. messydos
- X or crossdos. {not in Vi}
- X
- Xshowcmd (sc) toggle (default on)
- X show command in status line. Set this option off if your terminal
- X is slow. {not in Vi}
- X
- Xshowmatch (sm) toggle (default off)
- X When a bracket is inserted, briefly jump to the matching one.
- X
- Xshowmode (mo) toggle (default on)
- X If in insert or replace mode, put a message on the last line.
- X
- Xsmartindent (si) toggle (default off)
- X Do smart autoindenting in insert mode for C programs. Insert or
- X delete indents at appropriate places. {not in Vi}
- X
- Xsuffixes (su) string (default ".bak.o.h.info.vim")
- X Files with these suffixes are ignored when multiple files match a
- X wildcard.
- X
- Xtabstop (ts) number (default 8)
- X Number of spaces that a <TAB> in the file counts for.
- X
- Xtaglength (tl) number (default 0)
- X If non-zero, tags are significant upto this number of characters.
- X
- Xtags string (default "tags")
- X Filenames for the tag command, separated by spaces. {Vi: default is
- X "tags /usr/lib/tags"}
- X
- Xterm string (default "amiga")
- X Name of the terminal. Used for choosing the terminal control
- X characters.
- X
- Xterse toggle (default on)
- X Ignored. {Vi: shorten the error messages}
- X
- Xtildeop (to) toggle (default off)
- X The tilde command <~> behaves like an operator. {not in Vi}
- X
- Xtimeout toggle (default on)
- Xttimeout toggle (default off)
- X These two options together determine the behaviour when part of a
- X mapped key sequence or keyboard code has been received:
- X
- X timeout ttimeout action
- X off off no time out
- X on on or off time out on :mappings and key codes
- X off on time out on key codes
- X
- X If there is no time out, Vim will wait until either the complete
- X mapping or key sequence has been received, or it is clear that there
- X is no mapping or key sequence for the received characters. For
- X example: if you have mapped "vl" and Vim has received "v", the next
- X character is needed to see if the "v" is followed by an "l". With a
- X time out Vim will wait for about 1 second for the next character to
- X arrive. After that the already received characters are interpreted
- X as single characters.
- X On slow terminals or very busy systems time out may cause
- X malfunctioning cursor keys. If both options are off, Vim waits
- X forever after an entered <ESC> if there are key codes that start
- X with <ESC>. You will have to type <ESC> twice. If you do not have
- X problems with key codes, but would like to have :mapped key
- X sequences not time out in 1 second, set the ttimeout option and
- X reset the timeout option. {the ttimeout option is not in Vi}
- X
- Xtextwidth number (default 9999)
- X Maximum width of text that is being inserted. A longer line will be
- X broken after white space to get this width. {not in Vi}
- X
- Xundolevels (ul) number (default 100)
- X Maximum number of changes that can be undone (set to 0 for Vi
- X compatibility). {not in Vi}
- X
- Xupdatecount (uc) number (default 100)
- X After this many characters typed the auto script file will be written
- X to disk. When zero the auto script will not be written to at all (see
- X chapter on recovery). {not in Vi}
- X
- Xupdatetime (ut) number (default 2000)
- X If this many milliseconds nothing is typed the auto script file will
- X be written to disk (see chapter on recovery). {not in Vi}
- X
- Xvisualbell (vb) toggle (default off)
- X Use (sort of) visual bell for AUX device. {not in Vi}
- X
- Xwrapmargin (wm) number (default 0)
- X Number of characters from the right window border where wrapping
- X starts. In Vim this is implemented by setting textwidth to the window
- X width minus the wrapmargin. {Vi: works differently and less useful}
- X
- Xwrapscan (ws) toggle (default on)
- X Searches wrap around the end of the file.
- X
- Xwriteany (wa) toggle (default off)
- X Do not check for allowance when writing files.
- X
- Xwritebackup (wb) toggle (default on)
- X Make a backup before overwriting a file. The backup is removed after
- X the file was succesfully written, unless the 'backup' option is also
- X on. {not in Vi}
- X
- Xyankendofline (ye) toggle (default off)
- X The Y command yanks from the cursor until the end of the line instead
- X of whole lines. {not in Vi}
- X
- X
- X 20. Terminal information
- X
- XVim uses information about the terminal you are using to fill the screen and
- Xrecognize what keys you hit. If this information is not correct the screen
- Xmay be messed up or keys may not be recognized. The actions which have to be
- Xperformed on the screen are accomplished by outputting a string of
- Xcharacters. Special keys produce a string of characters. These strings are
- Xstored in the terminal options, see section 20.2.
- X
- X
- X20.1 startup
- X
- XWhen Vim is started a default terminal type is assumed. For the Amiga this
- Xis a standard CLI window, for MSDOS the pc terminal, for Unix an ansi
- Xterminal. A few other terminal types are always available. Use the command
- X"set term=xxx" to find out which ones are builtin.
- X
- XYou can give the terminal name with the '-T' command line option. If it is
- Xnot given Vim will try to get the name from the TERM environment variable.
- X
- XOn Unix the termcap file is used. On Amiga and MSDOS this is only available
- Xif Vim was compiled with TERMCAP defined. If the termcap code is included
- XVim will try to get the strings for the terminal you are using from the
- Xtermcap file.
- X
- XFor normal editing the terminal will be put into "raw" mode. The strings
- Xdefined with "t_ts" and "t_ks" will be sent to the terminal. Normally this
- Xputs the terminal in a state where the termcap codes are valid and activates
- Xthe cursor and function keys. When Vim exits the terminal will be put back
- Xinto the mode it was before Vim started. The strings defined with "t_te" and
- X"t_ke" will be sent to the terminal. On the Amiga with commands that print
- Xmultiple lines at the bottom of the screen or execute an external command
- X(e.g. "!!", ":files") the terminal will be put into normal mode for a
- Xmoment. This means that you can stop the output to the screen by hitting a
- Xprinting key. Output resumes when you hit <BS>.
- X
- XSome termcap entries are wrong in the sense that after sending t_ks the
- Xcursor keys send codes different from the codes defined in the termcap. To
- Xavoid this you can set t_ks (and t_ke) to empty strings. This must be done
- Xduring initialization (see 3.4), otherwise its too late.
- X
- XSome termcap entries assume that the highest bit is always reset. For
- Xexample: The cursor-up entry for the amiga could be ":ku=\EA:". But the
- XAmiga really sends "\233A". This works fine if the highest bit is reset,
- Xe.g. when using an Amiga over a serial line. If the cursor keys don't work,
- Xtry the entry ":ku=\233A:".
- X
- XSome termcap entries have the entry ":ku=\E[A:". But the Amiga really sends
- X"\233A". On output "\E[" and "\233" are often equivalent, on input they
- Xaren't. You will have to change the termcap entry, or change the key code
- Xwith the :set command to fix this.
- X
- XMany cursor key codes start with an <ESC>. Vim must find out if this a
- Xsingle hit of the <ESC> key or the start of a cursor key sequence. It waits
- Xfor a next character to arrive. If it does not arrive within one second a
- Xsingle <ESC> is assumed. On very slow systems this may fail, causing cursor
- Xkeys not to work sometimes. If you discover this problem reset the 'timeout'
- Xoption. Vim will wait for the next character to arrive after an <ESC>. If
- Xyou want to enter a single <ESC> you must type it twice.
- X
- XOn the Amiga the regcognition of window resizing is activated only when the
- Xterminal name is "amiga" or "builtin_amiga".
- X
- X
- X20.2 terminal options
- X
- XIt is always possible to change individual strings by setting the
- Xappropriate option. For example:
- X
- X :set t_el=^V^[[K (CTRL-V, ESC, [, K)
- X
- XThe options are listed below along with the used termcap code. Two of them
- Xare required: Cursor positioning and clear screen. The others are used to
- Xminimize the screen updating overhead.
- X
- XYou can view the current codes with the command
- X
- X :set termcap
- X
- X
- X option termcap meaning
- X
- XOUTPUT CODES
- X t_name (name) name of current terminal entry
- X t_el ce clear to end of line
- X t_il al add new blank line
- X t_cil AL add number of blank lines
- X t_dl dl delete line
- X t_cdl DL delete number of lines
- X t_ed cl clear screen (required!)
- X t_ci ci highlight color
- X t_cv cv normal color
- X t_tp me normal mode
- X t_ti mr reverse mode
- X t_cm cm cursor motion (required!)
- X t_sr sr scroll reverse (backward)
- X t_cri RI cursor number of chars right
- X t_vb vb visual bell
- X t_ks ks put terminal in "keypad transmit" mode
- X t_ke ke out of "keypad transmit" mode
- X t_ts ti put terminal in "termcap" mode
- X t_te te out of "termcap" mode
- X
- XKEY CODES
- X t_ku ku arrow up
- X t_kd kd arrow down
- X t_kr kr arrow right
- X t_kl kl arrow left
- X t_sku (none) shift arrow up
- X t_skd (none) shift arrow down
- X t_skr %i shift arrow right
- X t_skl #4 shift arrow left
- X t_f1 k1 function key 1
- X t_f2 k2 function key 2
- X t_f3 k3 function key 3
- X t_f4 k4 function key 4
- X t_f5 k5 function key 5
- X t_f6 k6 function key 6
- X t_f7 k7 function key 7
- X t_f8 k8 function key 8
- X t_f9 k9 function key 9
- X t_f10 k; function key 10
- X t_sf1 F1 function key 11 or shifted function key 1
- X t_sf2 F2 function key 12 or shifted function key 2
- X t_sf3 F3 function key 13 or shifted function key 3
- X t_sf4 F4 function key 14 or shifted function key 4
- X t_sf5 F5 function key 15 or shifted function key 5
- X t_sf6 F6 function key 16 or shifted function key 6
- X t_sf7 F7 function key 17 or shifted function key 7
- X t_sf8 F8 function key 18 or shifted function key 8
- X t_sf9 F9 function key 19 or shifted function key 9
- X t_sf10 FA function key 20 or shifted function key 10
- X t_help %1 help key
- X t_undo &8 undo key
- X
- X
- X20.3 Window size
- X
- XIf you are running Vim on an Amiga and the terminal name is "amiga" or
- X"builtin_amiga", the amiga-specific window resizing will be enabled. On Unix
- Xsystems three methods are tried to get the window size:
- X
- X- the environment variables "LINES" and "COLUMNS"
- X- an ioctl call (TIOCGSIZE or TIOCGWINSZ, depends on your system)
- X- from the termcap entries "li" and "co"
- X
- XIf everything fails a default size of 24 lines and 80 columns is assumed. If
- Xa window-resize signal is received the size will be set again. If the window
- Xsize is wrong you can use the 'lines' and 'columns' options to set the
- Xcorrect values.
- X
- X
- X20.4 slow and fast terminals
- X
- XIf you have a fast terminal you may like to set the 'ruler' option. The
- Xcursor position is shown in the status line.
- X
- XIf you have a slow terminal you may want to reset the 'showcommand' option.
- XThe command characters will not be shown in the status line. If the terminal
- Xscrolls very slow, set the 'scrolljump' to 5 or so. If the cursor is moved
- Xoff the screen (e.g. with 'j') Vim will scroll 5 lines at a time.
- X
- XIf the characters from the terminal are arriving with more than 1 second
- Xbetween them you might want to set the 'timeout' and/or 'ttimeout' option.
- XSee the "Options" chapter.
- X
- X
- X 21. Differences from Vi and Ex
- X
- XThis chapter only lists what has not been mentioned in previous chapters.
- X
- X21.1 Missing commands
- X
- XA large number of the "Ex" commands (the commands that start with a colon)
- Xare included. However, there is no Ex mode.
- X
- XThese commands are in Vi, but not in Vim.
- X
- XQ {Vi: go to Ex mode}
- X
- X:a[ppend] {Vi: append text}
- X:c[hange] {Vi: replace lines}
- X:i[nsert] {Vi: insert text}
- X:l[ist] {Vi: list lines}
- X:nu[mber] {Vi: print specified lines with their line number}
- X:o[pen] {Vi: start editing in open mode}
- X:pres[erve] {Vi: emergency exit}
- X:rec[over] {Vi: recover a file after a crash or :preserve}
- X:una[bbreviate] {Vi: remove from abbreviation list}
- X:vi[sual] {Vi: switch from Ex or open to visual mode}
- X:z {Vi: print some lines}
- X:~ {Vi: do a substitute on the previous regular
- X expression}
- X
- X
- X21.2 Missing options
- X
- XThese options are in the unix Vi, but not in VIM.
- X
- Xautoprint (ap) toggle (default on)
- Xbeautify (bf) toggle (default off)
- Xedcompatible toggle (default off)
- Xhardtabs (ht) number (default 8)
- X number of spaces that a <TAB> moves on the display
- Xlisp toggle (default off)
- Xmesg toggle (default on)
- Xopen toggle (default on)
- Xoptimize (op) toggle (default on)
- Xprompt toggle (default on)
- Xredraw toggle (default off)
- Xslowopen (slow) toggle (default off)
- Xwarn toggle (default on)
- X warn when the file has changed before a ! command
- Xwindow number (default 24)
- Xw300 number (default 24)
- Xw1200 number (default 24)
- Xw9600 number (default 24)
- X
- X
- X 22. Credits
- X
- XParts of this manual comes from several Vi manuals, written by:
- X W.N. Joy
- X Alan P.W. Hewett
- X Mark Horton
- X
- XThe editor VIM is based on Stevie and includes (ideas from) other software,
- Xworked on by:
- X Tim Thompson Stevie
- X Tony Andrews Stevie
- X G. R. (Fred) Walter Stevie
- X Henry Spencer regular expressions
- X Steve Kirkendall Elvis
- X Juergen Weigert Lattice version, AUX improvements, UNIX and
- X MSDOS ports
- X Olaf Seibert DICE version and regexp improvements
- X Peter da Silva termlib
- X
- XI must thank all the people that sent me bug reports and suggestions.
- XThey keep Vim alive!
- Xvi:tw=76
- END_OF_FILE
- if test 41128 -ne `wc -c <'vim/doc/reference.doc3'`; then
- echo shar: \"'vim/doc/reference.doc3'\" unpacked with wrong size!
- fi
- # end of 'vim/doc/reference.doc3'
- fi
- echo shar: End of archive 19 \(of 23\).
- cp /dev/null ark19isdone
- MISSING=""
- for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 ; do
- if test ! -f ark${I}isdone ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have unpacked all 23 archives.
- rm -f ark[1-9]isdone ark[1-9][0-9]isdone
- else
- echo You still need to unpack the following archives:
- echo " " ${MISSING}
- fi
- ## End of shell archive.
- exit 0
- -------------8<----------------8<----------------8<---------------8<--------
- Bram Moolenaar | DISCLAIMER: This note does not
- Oce Nederland B.V., Research & Development | necessarily represent the position
- p.o. box 101, 5900 MA Venlo | of Oce-Nederland B.V. Therefore
- The Netherlands phone +31 77 594077 | no liability or responsibility for
- UUCP: mool@oce.nl fax +31 77 595450 | whatever will be accepted.
-
- exit 0 # Just in case...
-