home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-12-22 | 46.2 KB | 1,070 lines |
- Newsgroups: comp.sources.misc
- From: mool@oce.nl (Bram Moolenaar)
- Subject: v41i070: vim - Vi IMitation editor, v2.0, Part20/25
- Message-ID: <1993Dec21.172755.2004@sparky.sterling.com>
- X-Md4-Signature: 3a3366845d4e184f4c612b35a6ae7e05
- Keywords: utility, editor, vi, vim
- Sender: kent@sparky.sterling.com (Kent Landfield)
- Organization: Sterling Software
- Date: Tue, 21 Dec 1993 17:27:55 GMT
- Approved: kent@sparky.sterling.com
-
- Submitted-by: mool@oce.nl (Bram Moolenaar)
- Posting-number: Volume 41, Issue 70
- Archive-name: vim/part20
- Environment: UNIX, AMIGA, MS-DOS
- Supersedes: vim: Volume 37, Issue 1-24
-
- #! /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 20 (of 25)."
- # Contents: vim/doc/reference.do4
- # Wrapped by mool@oce-rd2 on Wed Dec 15 09:50:08 1993
- PATH=/bin:/usr/bin:/usr/ucb ; export PATH
- if test -f 'vim/doc/reference.do4' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'vim/doc/reference.do4'\"
- else
- echo shar: Extracting \"'vim/doc/reference.do4'\" \(43708 characters\)
- sed "s/^X//" >'vim/doc/reference.do4' <<'END_OF_FILE'
- 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 (or as long as specified with the 'timeoutlen'
- Xoption). After that it assumes that the <q> is to be interpreted as such. If
- Xtype slowly, or your system is slow, reset the 'timeout' option. Then you
- Xmight want to set the 'ttimeout' option. See the "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 losing any builtin function.
- X
- XIf you include an undo command inside a mapped sequence, this will bring the
- Xtext back in the state before executing the macro. This is compatible with
- Xthe original vi, as long as there is only one undo command in the mapped
- Xsequence (having two undo commands in a mapped sequence did not make sense
- Xin the original vi, you would get back the text before the first undo).
- X
- XThere are two ways to map a function key:
- X1. The vi-compatible method: Map the key code. Often this is a sequence that
- X starts with <ESC>. To enter a mapping like this you type ":map " and then
- X you have to type CTRL-V before hitting the function key.
- X2. The second method is to use the internal code for the function key. To
- X enter such a mapping just hit the function key, without CTRL-V, or use
- X the form "#1", "#2", .. "#9", "#0". Only the first ten function keys can
- X be used this way ("#0" refers to function key 10, defined with option
- X 't_f10', which may be function key zero on some keyboards).
- XThe advantage of the second method is that the mapping will mostly work on
- Xdifferent terminals without modification (the function key will be
- Xtranslated into the same internal code, no matter what terminal you are
- Xusing. The termcap must be correct for this to work, and you must use the
- Xsame mappings).
- X
- XDETAIL: Vim first checks if a sequence from the keyboard is mapped. If it
- Xisn't the terminal key codes are tried (see section 20.2). If a terminal
- Xcode is found it is replaced by the internal code. Then the check for a
- Xmapping is done again (so you can map an internal code to something else).
- XWhat is written into the script file (.vim file) depends on what is
- Xrecognized. If the terminal key code was recognized as a mapping the key
- Xcode itself is written to the script file. If it was recognized as a
- Xterminal code the internal code is written to the script file.
- 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 extension is
- Xused, ".vil", ".vik", etc. An existing file will never be overwritten. The
- Xautoscript file is deleted as soon as the edited text is successfully
- Xwritten 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 autoscript file in
- Xanother place than where the edited file is. The advantage is that you will
- Xnot pollute the directories with ".vim" files and, when the 'directory' is
- Xon another partition, reduce the risc of damaging the file system where the
- Xfile is (in a crash). The tradeoff is that you can get name collisions from
- Xfiles with the same name but in different directories. You can also use a
- Xrecoverable ram disk, but there is no 100% guarantee that this works.
- XPutting autoscript files in RAM: makes no sense, you will loose them in a
- Xcrash. Put a command resembling the following one 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. Once you are sure the recovery is ok, write out the
- Xfile with ":wq" and delete the autoscript ".vim" file. Otherwise, you will
- Xcontinue to get warning messages that the ".vim" file already exists.
- 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 of the window. Do not resize the window 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 does not end 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 from being used for a
- Xrecovery.
- 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 up to the next space will be
- Xskipped. Thus following arguments will be processed.
- X
- XAn environment variable in most string options will be expanded. This
- Xhappens only when the string starts with a <$>. If the environment variable
- Xexists the <$> and the following environment variable name is replaced by
- Xits value. If it does not exist the <$> and the name are not modified. Any
- Xnon-id character (not a letter, digit or <_>) may follow the environment
- Xvariable name. That character and what follows is appended to the value of
- Xthe environemnt variable. Example:
- X :set term=$TERM.new
- 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. If the 'exrc' option is set, the file ".vimrc" in the current directory is
- X read for Ex commands. You can include set commands in this file. If this
- X file is not found the file ".exrc" is tried.
- X6. If you start editing a new file, and the 'modeline' option is set, a
- X number of lines at the beginning and end of the file are checked for the
- X string "vi:", "vim:" or "ex:". The text after it is considered to be the
- X arguments for a ":set" command, separated with colons or spaces. For
- X example:
- X "vi:noai:sw=3 ts=6"
- X The number of lines that are checked can be set with the 'modelines'
- X option. If 'modeline' is not set or 'modelines' is 0 no lines are
- X checked.
- X The string "vi:", "vim:" or "ex:" must be preceded with a blank or begin
- X at the start of a line. This minimizes the chance that a normal word like
- X "lex:" is caught.
- X Note that all of the rest of the line is used, thus a line like:
- X "/* vi:ts=4: */"
- X will give an error message for the trailing "*/".
- X If an error is detected the rest of the line is skipped.
- X One other form of modelines is recognized that has the "set" command
- X after "vi:", "vim:" or "ex:" (this is compatible with some versions of
- X vi). In this case the characters up to the first <:> are executed as an
- X ex command. Anything following it is ignored. Thus a line like:
- X "/* vi:set ts=4: */"
- X is OK. If you want to include a <:> in a set command precede it with a
- X <\>.
- 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 parens. Both forms may be used. In this
- Xdocument when an option that can be toggled is "set" that means that ":set
- Xoption" is entered. When an option is "reset", ":set nooption" is 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 "Q" command or when you reach 'textwidth' in
- X Insert mode) uses the indentation of the first line. The 'autoindent'
- X option is reset when the 'paste' option is set.
- 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, :suspend, :tag, :!, :make, CTRL-]
- X and CTRL-^ command; and when a CTRL-O, CTRL-I, '<A-Z>, or `<A-Z>
- X command takes one to another file.
- 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 the file is being
- X written, reset this option and set the 'writebackup' option. If you
- X do not want a backup file at all reset both options (See the table
- X in section 5.4 for another explanation.). {not in Vi}
- X
- Xbackupdir (bdir) string (default "$HOME")
- 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. Environment variables are expanded. {not in Vi}
- X
- Xbinary (bin) toggle (default off)
- X This option should be set before editing a binary file. You can also
- X use the "-b" command line option. When this option is set the
- X 'textwidth' option will set to 0, the 'textmode' and 'textauto'
- X options will be reset and 'modelines' will be set to 0. When writing
- X a file the end-of-line for the last line is only written if there
- X was one in the original file (normally Vim appends an end-of-line to
- X the last line if there is none; this would make the file longer).
- X
- Xbioskey (bk) toggle (default on)
- X For MSDOS only: When set the bios is called to obtain a keyboard
- X character. This works better to detect CTRL-C, but only works for
- X the console. When using a terminal over a serial port reset this
- X option. {not in Vi}
- X
- Xcolumns number (default 80 or terminal width)
- 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 esckeys off no <ESC>-keys in Insert mode
- 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 revins off no reverse insert
- X ruler off no ruler
- X scrolljump 0 no jump scroll
- X shiftround off indent not rounded to shiftwidth
- X showcmd off command characters not shown
- X showmode off current mode not shown
- X smartindent off no smart indentation
- X textauto off no automatic textmode detection
- X textwidth 0 no automatic line wrap
- 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 Insert 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 may end in an <:> or </>. Environment
- X variables are expanded. Carefeful with <\> characters, type two to
- X get one in the option, ":set dir=c:\\tmp". {Vi: directory to put
- X temp file in, defaults to "/tmp"}
- X
- Xequalprg (ep) string (default "indent")
- X External program to use for "=" command. Environment variables are
- X expanded. {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" or "errors")
- X Name of the error file for the QuickFix mode (see 5.5). Environment
- X variables are expanded. {not in Vi}
- X
- Xerrorformat (efm) string (default "%f>%l:%c:%t:%n:%m" or
- X ""%f",%*[^0-9]%l %m")
- X Scanf-like description of the format for the lines in the error file
- X (see 5.5). {not in Vi}
- X
- Xesckeys (ek) toggle (default on)
- X Function keys that start with an <ESC> are recognized in Insert
- X mode. When this option is off, the cursor and function keys cannot be
- X used in Insert mode if they start with an <ESC>. The advantage of this
- X is that the single <ESC> is recognized immediately, instead of after
- X one second.
- X
- Xexpandtab (et) toggle (default off)
- X In Insert mode: Use the appropriate number of spaces to insert a
- X <TAB>. Spaces are used in indents with the '>' and '<' commands and
- X when 'autoindent' is set. To insert a real tab when expandtab is
- X set, use CTRL-V<TAB>. {not in Vi}
- X
- Xexrc toggle (default off)
- X Enables the reading of .vimrc and .exrc in the current directory. If
- X you switch this option on you should also consider setting the
- X 'secure' option (see 3.4). {not in Vi}
- X
- Xformatprg (fp) string (default "")
- X The name of an external program that will be used to format the
- X lines selected with the "Q" command. The program must take the input
- X on stdin and produce the output on stdout. The unix program 'fmt' is
- X such a program. If this option is an empty string, the internal
- X format function will be used. Environment variables are expanded.
- X {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 (Amiga) "vim:vim.hlp"
- X (unix) "/usr/local/lib/vim.hlp")
- X Name of the help file. It may start with an environment variable.
- X For example: "$VIM/doc/vim.hlp". Environment variables are expanded.
- X {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. Environment variables are
- X expanded. {not in Vi}
- X
- Xlines number (default 24 or terminal height)
- 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
- Xmakeprg (mp) string (default "make")
- X Program to use for the ":make" command. This option may contain
- X <%> and <#> characters, which are expanded like when used in a
- X command line. Environment variables are expanded. {not in Vi}
- X
- Xmodeline (ml) toggle (default on)
- Xmodelines (mls) number (default 5)
- X If 'modeline' is set 'modelines' gives the number of lines that is
- X checked for set commands. If 'modeline' is not set or 'modelines' is
- X 0 no lines are checked. See 19.1. {not 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 (see section 6.4).
- X
- Xpaste toggle (default off)
- X Put Vim in Paste mode. This is useful if you want to cut or copy
- X some text from one window and paste it in Vim. This will avoid
- X unexpected effects. When the 'paste' option is set mapping in Insert
- X mode is disabled, abbreviations are disabled and some options are
- X reset ('textwidth', 'autoindent', 'smartindent', 'revins', 'ruler'
- X and 'showmatch'). When the 'paste' option is reset the mentioned
- X options are restored to the value before the last time 'paste' was
- X set. If you use this often, you could map a function key to the
- X command ":set invpaste^V^M". {not in Vi}
- X
- Xreadonly (ro) toggle (default off)
- X If set, writes fail unless you use an !. Protects you from
- X accidentally overwriting a file. Also, sets 'updatecount' to zero so
- X that no ".vim" autoscript file is created. Default on when vim is
- X started in view mode ("vim -v") or when the executable is called
- X "view". It is reset if you overwrite the current file (e.g. with
- X ":w!"). WARNING: An edit session that starts with 'noreadonly' won't
- X be protected with a .vim autoscript file unless 'updatecount' is set
- X back to some non-zero number (e.g. 100).
- 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
- Xreport number (default 2)
- X Threshold for reporting number of lines changed.
- X
- Xrevins toggle (default off)
- X Inserting characters in Insert mode will work backwards. See "typing
- X backwards". Can be toggled with the CTRL-P command in Insert mode.
- X This option is reset when 'compatible' or 'paste' is set. {not in Vi}
- X
- Xruler (ru) toggle (default off)
- X Show the line and column number of the cursor position in the status
- X line, separated by a comma. If there are characters in the line that
- X take two positions on the screen, both the "real" column and the
- X screen column are shown, separated with a dash. This option is reset
- X when the 'paste' option is set. {not in Vi}
- X
- Xsecure toggle (default off)
- X When on, shell and write commands are not allowed in ".vimrc" and
- X ".exrc" in the current directory and map commands are displayed.
- X Switch it off only if you know that you will not run into problems,
- X or when the 'exrc' option is off.
- X
- Xscroll number (default 'lines' / 2)
- X Number of lines to scroll with CTRL-U and CTRL-D commands. Will be
- X set to half the number of lines in the window when the window size
- X changes. If you give a count to the CTRL-U or CTRL-D command it will
- X be used as the new value for 'scroll'. Reset to 'lines' / 2 with
- X ":set scroll=0".
- 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 slowly. {not in Vi}
- X
- Xsections (sect) string (default "SHNHH HUnhsh")
- X Specifies the nroff macros that separate sections. These are pairs of
- X two letters (See section 6.4).
- X
- Xshell (sh) string (default $SHELL or "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. Environment
- X variables are expanded.
- 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 extension 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 extension (".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, off for unix)
- 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. This
- X option is reset when the 'paste' option is set.
- X
- Xshowmode (smd) toggle (default on)
- X If in Insert or Replace mode, put a message on the last line.
- X
- Xsidescroll (ss) number (default 0)
- X The minimal number of columns to scroll horizontally. Used only when
- X the 'wrap' option is on and the cursor is moved off of the screen.
- X When set to zero the cursor will be put in the middle of the screen.
- X When using a slow terminal set it to a large number or 0. When using
- X a fast terminal use a small number or 1. {not in Vi}
- X
- Xsmartindent (si) toggle (default off)
- X Do smart autoindenting for C programs in Insert mode and with the
- X "o" and "O" commands. An indent is automatically inserted:
- X - After a line ending in <{>.
- X - After a line starting with "if", "for", "while", "else" or "do".
- X If you type a <{> as the first character in the new line, the
- X indent is deleted.
- X - Before a line starting with <}> (only with the "O" command).
- X One indent is deleted when typing <}> as the first character in a
- X new line.
- X 'smartindent' is reset when the 'paste' option is set. {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. {not in Vi}
- 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 up to this number of characters.
- X
- Xtags string (default "tags")
- X Filenames for the tag command, separated by spaces. Environment
- X variables are expanded for the first name. {Vi: default is "tags
- X /usr/lib/tags"}
- X
- Xterm string (default $TERM or "amiga" on Amiga, "pcterm"
- X on MSDOS)
- X Name of the terminal. Used for choosing the terminal control
- X characters. Environment variables are expanded.
- X
- Xterse toggle (default on)
- X Ignored. {Vi: shorten the error messages}
- X
- Xtextauto (ta) toggle (default on)
- X When a new file is edited the first line is checked for the line
- X separator. If it is a single <LF> 'textmode' is reset. If it is a
- X <CR><LF> pair 'textmode' is set.
- X
- Xtextmode (tx) toggle (MSDOS: default on, others: default off)
- X When off, <LF> separates lines. When on, <CR><LF> separates lines.
- X Only used when reading and writing files. Set automatically when
- X reading a file and 'textauto' is on.
- X
- Xtextwidth number (default 0)
- X Maximum width of text that is being inserted. A longer line will be
- X broken after white space to get this width. A zero value disables
- X this. 'textwidth' is set to 0 when the 'paste' option is set. If
- X 'wrapmargin' is set to non-zero, textwidth is set to
- X ('columns' - 'wrapmargin'). {not in Vi}
- 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. The time can be set with the 'timeoutlen'
- X option.
- 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
- Xtimeoutlen (tm) number (default 1000)
- X The time in milliseconds that is waited for a key code or mapped key
- X sequence to complete. {only in some versions of Vi}
- X
- Xundolevels (ul) number (default 100)
- X Maximum number of changes that can be undone. Set to 0 for Vi
- X compatibility: one level of undo and 'u' undoes itself. Set to a
- X negative number for no undo at all (saves memory). {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
- Xwarn toggle (default on)
- X Give a warning message when a shell command is used while the buffer
- X has been changed.
- X
- Xwildchar (wc) number (default <TAB> or CTRL-E)
- X Character you have to type to start wildcard expansion in the
- X command line. CTRL-E is used when Vim was compiled with COMPATIBLE
- X or when the 'compatible' option is set. The character is not
- X recognized when used inside a macro. {not in Vi}
- X
- Xwrap toggle (default on)
- X When on, long lines will wrap and continue on the next line. When
- X off long lines will not wrap and only part of them will be shown.
- X When the cursor is moved to a part that is not shown, the screen
- X will scroll horizontally (also see 'sidescroll' option. {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 Allows writing to any file with no need for "!" override.
- 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
- Xdone during 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. Resetting the
- X'esckeys' option avoids this problems in Insert mode, but you lose the
- Xpossibility to use cursor and function keys in Insert mode.
- X
- XOn the Amiga the recognition of window resizing is activated only when the
- Xterminal name is "amiga" or "builtin_amiga".
- X
- XSome terminals have confusing codes for the cursor keys. The televideo 925
- Xis such a terminal. It sends a CTRL-H for cursor-left. This would make it
- Ximpossible to distinguish a backspace and cursor-left. To avoid this problem
- XCTRL-H is never recognized as cursor-left.
- X
- X
- X20.2 terminal options
- X
- XThe terminal options can be set just like normal options. But they are not
- Xshown with the ":set all" command. Instead use ":set termcap".
- 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
- X{Vi: no terminal options. You have to exit vi, edit the termcap entry and
- Xtry again}
- X
- XThe options are listed below along with the associated termcap code. Two of
- Xthem are required: Cursor positioning and clear screen. The others are used
- Xto minimize the screen updating overhead and to recognize special keys.
- 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 vi cursur invisible
- X t_cv ve cursur visible
- X t_tp me normal mode
- X t_tp se shift-out end (if 'mr' or 'me' not defined)
- X t_ti mr reverse mode
- X t_ti so shift-out mode (if 'mr' or 'me' not defined)
- 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
- XNote for xterm users: The shifted cursor keys normally don't work. You can
- X make them work with the xmodmap command and some mappings in Vim.
- X
- X Give these commands in the xterm:
- X xmodmap -e "keysym Up = Up F16"
- X xmodmap -e "keysym Down = Down F17"
- X xmodmap -e "keysym Left = Left F18"
- X xmodmap -e "keycode Right = Right F19"
- X
- X And use these mappings in Vim:
- X :map CTRL-V 151 CTRL-V 132
- X :map! CTRL-V 151 CTRL-V 132
- X :map CTRL-V 152 CTRL-V 133
- X :map! CTRL-V 152 CTRL-V 133
- X :map CTRL-V 153 CTRL-V 134
- X :map! CTRL-V 153 CTRL-V 134
- X :map CTRL-V 154 CTRL-V 135
- X :map! CTRL-V 154 CTRL-V 135
- X
- XWhere 151-154 are the internal vim decimal codes for function keys F16 to
- XF19 and 132-135 are the codes for the shifted arrow keys.
- 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- an ioctl call (TIOCGSIZE or TIOCGWINSZ, depends on your system)
- X- the environment variables "LINES" and "COLUMNS"
- 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. If you are using horizontal
- Xscrolling ('wrap' option off) consider setting 'sidescroll' to a small
- Xnumber.
- X
- XIf you have a slow terminal you may want to reset the 'showcmd' option.
- XThe command characters will not be shown in the status line. If the terminal
- Xscrolls very slowly, 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. Another
- Xpossibility is to reduce the number of lines that Vim uses with the command
- X"z<height><CR>".
- 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.
- XAlso see "difference.doc".
- 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: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: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. If you try to set them you
- Xwon't get an error message, but their value cannot be printed.
- 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)
- Xsourceany toggle (default not documented)
- Xttytype string
- 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:ts=8:sw=8
- END_OF_FILE
- if test 43708 -ne `wc -c <'vim/doc/reference.do4'`; then
- echo shar: \"'vim/doc/reference.do4'\" unpacked with wrong size!
- fi
- chmod +x 'vim/doc/reference.do4'
- # end of 'vim/doc/reference.do4'
- fi
- echo shar: End of archive 20 \(of 25\).
- cp /dev/null ark20isdone
- 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 24 25 ; do
- if test ! -f ark${I}isdone ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have unpacked all 25 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
-
- ===============================================================================
- 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 595473 | whatever will be accepted.
-
- exit 0 # Just in case...
-