CONTENTS
[Note: The commands for multiple windows and buffers are explained in
a different file, see vim_win.html]
- Introduction
- Notation
- Starting Vim
- Command line
- Workbench (Amiga only)
- Vim window (Amiga only)
- Initialization
- Suspending
- The viminfo file
- Modes
- Introduction
- Switching from mode to mode
- Insert and Replace mode
- special keys
- special special keys
- 'textwidth' option
- 'expandtab' option
- Replace mode
- Insert mode completion
- Command_line mode
- Command line editing
- Command line completion
- Ex command lines
- Ex command line ranges
- Ex special characters
- The window contents
- Abbreviations
- Digraphs
- Using the mouse
- On-line help
- Editing files
- Introduction
- Editing a file
- The argument list
- Writing and quitting
- Using the QuickFix mode
- Editing binary files
- Automatic commands
- Cursor motions
- Left-right motions
- Up-down motions
- Word motions
- Text object motions
- Text object selection
- Pattern searches
- Various motions
- Scrolling
- Tags and special searches
- Tags
- Identifier searches
- Inserting text
- Deleting text
- Changing text
- Delete and insert
- Simple changes
- Complex changes
- Formatting text
- Formatting C programs
- Copying and moving text
- Visual mode
- Various commands
- Repeating commands
- Single repeats
- Multiple repeats
- Complex repeats
- Undo and redo
- Key mapping
- Recovery after a crash
- The swap file
- Recovery
- Options
- Setting
options
- Automatically
setting options
- Saving
settings
- Options
summary
- Terminal information
- Startup
- Terminal options
- Window size
- Slow and fast terminals
- Differences from Vi and Ex
- Missing commands
- Missing options
- Limits
19. Options
Vi has a number of internal variables and switches which can be set to
achieve special effects. These options come in three forms:
| toggle |
can only be on or off
|
| number |
has a numeric value
|
| string |
has a string value
|
19.1 Setting options
- :se[t]
- Show all options that differ from their default value.
- :se[t] all
- Show all but terminal options.
- :se[t] termcap
- Show all terminal options.
- :se[t] {option}?
- Show value of {option}.
- :se[t] {option}
- Toggle option: set, switch it on.
Number option: show value.
String option: show value.
- :se[t] no{option}
- Toggle option: Reset, switch it off.
- :se[t] {option}! or
- :se[t] inv{option}
- Toggle option: Invert value. {not in Vi}
- :se[t] {option}&
- Reset option to its default value. {not in Vi}
- :se[t] {option}={value} or
- :se[t] {option}:{value}
-
Set string or number option to {value}. For numeric
options the value can be given in decimal, hex
(preceded with 0x) or octal (preceded with '0')
(hex and octal are only available for machines which
have the strtol() function). The old value can be
inserted by typing <Tab> (or whatever the value of
'wildchar' is). See 4.4.2 Command line completion.
See backslash option for using backslashes in
{value}.
- :fix[del]
- Set the value of 't_kD':
| 't_kb' is |
't_kD' becomes
|
| CTRL-? |
CTRL-H
|
| not CTRL-? |
CTRL-?
|
(CTRL-? is 0177 octal, 0x7f hex) {not in Vi}
If your delete key terminal code is wrong, but the
code for backspace is allright, you can put this in
your .vimrc:
- :fixdel
This works no matter what the actual code for
backspace is.
If the backspace key terminal code is
wrong you can use this:
- :set t_kb=^V
- :fixdel
Where "^V" is CTRL-V and "" is the backspace
key. This will only work for terminals with the same
code for the backspace key, you cannot use this in
your .vimrc unless the code for backspace is the same
on all your systems.
If your key sends a strange key sequence (not
CTRL-? or CTRL-H) you cannot use ":fixdel". Then use:
- :set t_kD=^V
Where "^V" is CTRL-V and "" is the delete key.
This will only work on systems with the same terminal
codes for delete.
Note about Linux: By default the backspace key
produces CTRL-?, which is wrong. You can fix it by
putting this line in your rc.local:
- echo "keycode 14 = BackSpace" | loadkeys
The {option} arguments to ":set" may be repeated. For example:
":set ai nosi sw=3 ts=3".
If you make an error in one of the arguments an error message will be given
and the text up to the next space will be skipped. Thus following arguments
will be processed.
For {option} the form "t_xx" may be used to set a termcap option. This will
override the value from the termcap. You can then use it in a mapping. If the
"xx" part contains special characters, use the <t_xx> form:
:set <t_#4>=^[Ot
The listing from ":set" looks different from Vi. Long string options are put
at the end of the list. The number of options is quite large. The output of
"set all" probably does not fit on the screen, causing Vim to give the
"--more--" message. See the 'more' option.
Environment variables in most string options will be expanded. If the
environment variable exists the '$' and the following environment variable
name is replaced with its value. If it does not exist the '$' and the name
are not modified. Any non-id character (not a letter, digit or '_') may
follow the environment variable name. That character and what follows is
appended to the value of the environment variable. Examples:
:set term=$TERM.new
:set path=/usr/$INCLUDE,$HOME/include,.
Using "~" is like using "$HOME", but it is only recognized at the start of an
option and after a space or comma.
To include white space in a string option value it has to be preceded with a
backslash. To include a backslash you have to use two. Effectively this
means that the number of backslashes in an option value is halved (rounded
down).
A few examples:
:set tags=tags\ /usr/tags results in "tags /usr/tags"
:set tags=tags\\,file results in "tags\,file"
:set tags=tags\\\ file results in "tags\ file"
For MS-DOS and WIN32 backslashes in file names are mostly not removed. More
precise: For options that expect a file name (those where environment
variables are expanded) a backslash before a normal file name character is not
removed. But a backslash before a special character (space, backslash, comma,
etc.) is used like explained above.
19.2 Automatically setting options
Besides changing options with the ":set" command, there are seven alternatives
to set options automatically for one or more files. The first four are used
for all files. The fifth is used to set options for the files in one
directory. The last two are used to set options for a single file. The first
five are done when you start Vim, in the given order. The last two are done
whenever you start editing a new file.
- The environment variable VIMINIT is read for an Ex command. You can set
VIMINIT to something like "set noai sw=3" to set options.
- Only if 1. fails, the file "~/.vimrc" (for Unix), "s:.vimrc" (Amiga) or
"$VIM\_vimrc" (MS-DOS) is read for Ex commands. You can include set
commands in this file. (see below for how to automatically create a file
with set commands).
- If both 1. and 2. fail, EXINIT is used, in the same way as VIMINIT.
- If 1., 2. and 3. all fail, the file "~/.exrc" (for Unix), "s:.exrc" (Amiga)
or "$VIM\_exrc" is read for Ex commands.
- If the 'exrc' option is on, the file ".vimrc" in the current directory is
read for Ex commands. You can include Ex commands in this file. If this
file is not found the file ".exrc" is tried.
- If you start editing a new file, the automatic commands are executed.
This can be used to set options for files matching a particular pattern and
many other things. See the section "Automatic commands" autocommand.
- If you start editing a new file, and the 'modeline' option is on, a
number of lines at the beginning and end of the file are checked for
modelines.
There are two forms of modelines. The first form:
[text]{white}{vi:|vim:|ex:}[white]{options}
| [text] |
any text or empty
|
| {white} |
at least one white space ( or )
| {vi:|vim:|ex:} |
the string "vi:", "vim:" or "ex:"
|
| [white] |
optional white space
|
| {options} |
a list of option settings, separated with white space or ':',
where each part between ':' is the argument for a ":set"
command
| |
Example:
" vi:noai:sw=3 ts=6"
The second form (this is compatible with some versions of Vi):
[text]{white}{vi:|vim:|ex:}[white]set {options}:[text]
| [text] |
any text or empty
|
| {white} |
at least one white space ( or )
| {vi:|vim:|ex:} |
the string "vi:", "vim:" or "ex:"
|
| [white] |
optional white space
|
| set |
the string "set " (note the space)
|
| {options} |
a list of options, separated with white space, which is the argument for a ":set" command
|
| : |
a colon
|
| [text] |
any text or empty
| |
Example:
"/* vim: set ai tw=75: */"
The white space before {vi:|vim:|ex:} is required. This minimizes the chance
that a normal word like "lex:" is caught. There is one exception: "vi:" and
"vim:" can also be at the start of the line (for compatibility with version
3.0). Using "ex:" at the start of the line will be ignored (this could be
short for "example:").
The number of lines that are checked can be set with the 'modelines' option.
If 'modeline' is off or 'modelines' is 0 no lines are checked.
Note that for the first form all of the rest of the line is used, thus a line
like:
"/* vi:ts=4: */"
will give an error message for the trailing "*/". This line is OK:
"/* vi:set ts=4: */"
If an error is detected the rest of the line is skipped.
If you want to include a ':' in a set command precede it with a '\'. No other
commands than "set" are supported, for security reasons (somebody might create
a trojan horse text file with modelines).
19.3 Saving settings
- :mk[exrc] [file]
- Write current key mappings and changed options to
[file] (default ".exrc" in the current directory),
unless it already exists. {not in Vi}
- :mk[exrc]! [file]
- Always write current key mappings and changed
options to [file] (default ".exrc" in the current
directory). {not in Vi}
- :mkv[imrc][!] [file]
- Like as :mkexrc, but default is ".vimrc" in the
current directory. The ":version" command is also
written to the file. {not in Vi}
These commands will write ":map" and ":set" commands to a file, in such a way
that when these commands are executed, the current key mappings and options
will be set to the same values. The options 'columns', 'endofline', 'lines',
'scroll', 'term' and 'ttyfast' are not included, because these are terminal
or file dependent. Note that the options 'binary', 'textmode', 'paste' and
'readonly' are included, this might not always be what you want.
A common method is to use a default ".vimrc" file, make some modifications
with ":map" and ":set" commands and write the modified file. First read the
default ".vimrc" in with a command like ":source ~piet/.vimrc.Cprogs", change
the settings and then save them in the current directory with ":mkvimrc!". If
you want to make this file your default .vimrc, move it to your home directory
(on Unix), s: (Amiga) or $VIM directory (MS-DOS). You could also use
autocommands and/or modelines.
19.4 Options summary
In the list below all the options are mentioned with their full name and some
with an abbreviation between parens. Both forms may be used. In this
document when an option that can be toggled is "set" that means that ":set
option" is entered. When an option is "reset", ":set nooption" is used.
Most options are the same in all windows and buffers. There are a few that
are specific to how the text is presented in a window. These can be set to a
different value in each window. For example the 'list' option can be set in
one window and reset in another for the same text, giving both types of view
at the same time. There are a few options that are specific to a certain
file. These can have a different value for each file or buffer. For example
the 'textwith' option can be 78 for a normal text file and 0 for a C
program.
When creating a new window the option values from the currently active window
are used as a default value for the window-specific options. For the
buffer-specific options this depends on the 's' and 'S' flags in the
'cpoptions' option. If 's' in included (which is the default) the values for
buffer options are copied from the currently active buffer when a buffer is
first entered. If 'S' is present the options are copied each time the buffer
is entered, this is almost like having global options. If 's' and 'S' are not
present, the options are copied from the currently active buffer when the
buffer is created.
A jump table for the options with a short description can be found at Option Table.
| aleph (al) | number (default 128 for MSDOS, 224 otherwise) |
-
The ASCII code for the first letter of the Hebrew alphabet. The
routine that maps the keyboard in Hebrew mode, both in Insert mode
(when hkmap is set) and on the command line (when hitting CTRL-_)
outputs the Hebrew characters in the range [aleph..aleph+26].
aleph=128 applies to PC code, and aleph=224 applies to ISO 8859-8.
This option applies only if Vim was compiled with RIGHTLEFT. See
vim_rlh.html. {not in Vi}
-
| autoindent (ai) | toggle (default off) |
- Copy indent from current line when starting a new line (typing <CR>
in Insert mode or when using the "o" or "O" command). If you do not
type anything on the new line except <BS> and then type <Esc> or
<CR>, the indent is deleted again. When autoindent is on,
formatting (with the "Q" command or when you reach 'textwidth' in
Insert mode) uses the indentation of the first line. When
'smartindent' or 'cindent' is on the indent is changed in specific
cases. The 'autoindent' option is reset when the 'paste' option is
set. {small difference from Vi: After the indent is deleted when
typing <Esc> or <CR>, the cursor position when moving up or down is
after the deleted indent; Vi puts the cursor somewhere in the deleted
indent}. Each buffer has its own copy of this option.
-
| autowrite (aw) | toggle (default off) |
- Write the contents of the file, if it has been modified, on each
:next, :rewind, :previous, :stop, :suspend, :tag, :!, :make, CTRL-]
and CTRL-^ command; and when a CTRL-O, CTRL-I, '<A-Z0-9>, or `<A-Z0-9>
command takes one to another file.
-
| backspace (bs) | number (default 0) |
- Influences the working of <BS>, <Del>, CTRL-W and CTRL-U in Insert
mode. If set to 0 Vi compatible backspacing is used. When 1 allow
backspacing over newlines. When larger than 1 allow backspacing over
the start of insert. In the last case CTRL-W and CTRL-U stop once at
the start of insert. See :fixdel if your <BS> or <Del> key does not
do what you want. {not in Vi}
-
| backup (bk) | toggle (default off) |
- Make a backup before overwriting a file. Leave it around after the
file has been successfully written. If you do not want to keep the
backup file, but you do want a backup while the file is being
written, reset this option and set the 'writebackup' option (this is
the default). If you do not want a backup file at all reset both
options (use this if your file system is almost full). See the backup_table
in section 5.4 for more explanations. {not in Vi}
-
| backupdir (bdir) | string (default for Amiga: ".,t:",
for MS-DOS and Win32: ".,c:/tmp,c:/temp"
for Unix: ".,~/tmp,~/")
) |
- List of directories for the backup file, separated with commas.
- The backup file will be created in the first directory in the list
where this is possible.
- Empty means that no backup file will be created ('patchmode' is
impossible!).
- A directory '.' means to put the backup file in the same directory
as the edited file. Characters after the "." are ignored, "./temp" is
handled in the same way as ".".
- Spaces after the comma are ignored, other spaces are considered part
of the directory name. To have a space at the start of a directory
name, precede it with a backslash.
- To include a comma in a directory name precede it with a backslash.
- A directory name may end in an '/'.
- Environment
variables are expanded.
- Careful with '\' characters, type one before a space, type two to
get one in the option (see backslash option), for example:
- :set bdir=c:\\tmp,\ dir\\,with\\,commas,\\\ dir\ with\ spaces
- For backwards compatibility with Vim version 3.0 a '>' at the start
of the option is removed.
See also 'backup' and 'writebackup' options. {not in Vi}
-
| backupext (bex) | string (default "~") |
- String which is appended to a file name to make the name of the
backup file. The default is quite unusual, because this avoids
accidently overwriting existing files with a backup file. You might
prefer using ".bak", but make sure that you don't have files with
".bak" that you want to keep. {not in Vi}
-
| binary (bin) | toggle (default off) |
- This option should be set before editing a binary file. You can also
use the "-b" command line option. When this option is switched from
off to on a few options will be changed:
| 'textwidth' |
will be set to 0
|
| 'wrapmargin' |
will be set to 0
|
| 'modeline' |
will be off
|
| 'textmode' |
will be off
|
| 'textauto' |
will be off
|
| 'expandtab' |
will be off
|
The previous values of these options are remembered and restored when
'bin' is switched off again.
When writing a file the end-of-line for the last line is only written
if there was one in the original file (normally Vim appends an
end-of-line to the last line if there is none; this would make the
file longer). See the 'endofline' option. Each buffer has its own
copy of this option. {not in Vi}
-
| bioskey (biosk) | toggle (default on) |
- For MS-DOS only: When on the bios is called to obtain a keyboard
character. This works better to detect CTRL-C, but only works for
the console. When using a terminal over a serial port reset this
option. {not in Vi}
-
| breakat (brk) | string (default " ^I!@*-+_;:,./?") |
- This option lets you choose which characters might cause a line
break if 'linebreak' is on. {not in Vi}
-
| cindent (cin) | toggle (default off) |
- Enables automatic C program indenting See 'cinkeys' to set the keys
that trigger reindenting in insert mode and 'cinoptions' to set your
preferred indent style. If 'lisp' is not on and 'equalprg' is empty,
the "=" operator indents using this algorithm rather than calling an
external program. See C_indenting. Each buffer has its own copy
of this option. This option is switched off when 'paste' is set.
When you don't like the way 'cindent' works, try the 'smartindent'
option. {not in Vi} {Only when compiled with CINDENT enabled,
":version" says "+cindent" instead of "-cindent"}
cinkeys (cink) string (default "0{,0},:,0#,!^F,o,O,e")
A list of keys that, when typed in insert mode, cause reindenting of
the current line. Only happens if 'cindent' is on. See
C_indenting. Each buffer has its own copy of this option. {not in
Vi}
-
| cinoptions (cino) | string (default "") |
- The 'cinoptions' affect the way 'cindent' reindents lines in a C
program. See C_indenting. Each buffer has its own copy of this
option. {not in Vi}
-
| cinwords (cinw) | string (default "if,else,while,do,for,switch") |
- These keywords start an extra indent in the next line when
'smartindent' or 'cindent' is set. {not in Vi}
-
| cmdheight (ch) | number (default 1) |
- Number of lines to use for the command line. If you are annoyed by
"Hit return ..." caused by long messages, set this option to a larger
value. {not in Vi}
-
| columns (co) | number (default 80 or terminal width) |
- Number of columns of the screen. Normally this is set by the
terminal initialization and does not have to be set by hand. {not in
Vi}
-
| comments (com) | string (default "/* ,* ,*/,//,# ,%,XCOMM") |
- A comma separated list of patterns that can start a comment line. See
format_comments. See option_backslash for using backslashes to
insert a space. Each buffer has its own copy of this option. {not in
Vi}
-
| compatible (cp) | toggle (default off) |
- At the moment this option is set, several other options will be set
or reset to make Vim Vi-compatible. Switching this option off has no
effect. See also 'cpoptions'. {not in Vi}
| option |
new value |
effect
|
| backspace |
0 |
normal backspace
|
| backup |
off |
no backup file
|
| cindent |
off |
no C code indentation
|
| cpoptions |
"bceorsStx$%" |
vi-compatible flags
|
| digraph |
off |
no digraphs
|
| esckeys |
off |
no <Esc>-keys in Insert mode
|
| expandtab |
off |
tabs not expanded to spaces
|
| formatoptions |
"v" |
Vi compatible formatting
|
| history |
0 |
no commandline history
|
| smartcase |
0 |
no automatic ignore case switch
|
| insertmode |
off |
do not start in Insert mode
|
| iskeyword |
"@,48-57,_" |
keywords contain alphanumeric characters and '_'
|
| joinspaces |
on |
insert 2 spaces after period
|
| modeline |
off |
no modelines
|
| more |
off |
no pauses in listings
|
| revins |
off |
no reverse insert
|
| ruler |
off |
no ruler
|
| scrolljump |
1 |
no jump scroll
|
| scrolloff |
0 |
no scroll offset
|
| shiftround |
off |
indent not rounded to shiftwidth
|
| showcmd |
off |
command characters not shown
|
| showmode |
off |
current mode not shown
|
| smartindent |
off |
no smart indentation
|
| startofline |
on |
goto startofline with some commands
|
| textauto |
off |
no automatic textmode detection
|
| textwidth |
0 |
no automatic line wrap
|
| tildeop |
off |
tilde is not an operator
|
| ttimeout |
off |
no terminal timeout
|
| undolevels |
0 |
no multilevel undo
|
| updatecount |
0 |
no swap file
|
| writebackup |
off |
no backup file written
|
-
| cpoptions (cpo) | string (default "ces") |
- Sequence of characters. When a character is present this indicates
vi-compatible behaviour. This is used for things where not being
vi-compatible is mostly or sometimes preferred. 'cpoptions' stands
for 'compatibleoptions'. Commas can be added for readability.
| contains |
behaviour
|
| b |
"\|" in a ":map" command is recognized as the end of
the map command. The '\' is included in the mapping,
the text after the '|' is interpreted as the next
command. Use a CTRL-V instead of a backslash to
include the '|' in the mapping. Applies to all
mapping, abbreviation, menu and autocmd commands.
See also map_bar.
|
| c |
Searching continues at the end of any match at the
cursor position. When not present searching continues
one character from the cursor position. With 'c'
"abababababab" only gets three matches when repeating
"/abab", without 'c' there are five matches.
|
| e |
When executing a register with ":@r", always add a
<CR> to the last line, also when the register is not
linewise. If this flag is not present, the register
is not linewise and the last line does not end in a
<CR>, then the last line is put on the command line
and can be edited before hitting <CR>.
|
| m |
When included, a showmatch will always wait half a
second. When not included, a showmatch will wait half
a second or until a character is typed. See 'showmatch'
|
| o |
Line offset to search command is not remembered for
next search.
|
| r |
Redo ("." command) uses "/" to repeat a search
command, instead of the actually used search string.
|
| s |
Set buffer options when entering the buffer for the
first time. This is like it is in Vim version 3.0.
And it is the default. If not present the options are
set when the buffer is created.
|
| S |
Set buffer options always when entering a buffer
(except 'readonly' and 'textmode'). This is the
(most) vi compatible setting.
The options are set to the values in the current
buffer. When you change an option and go to another
buffer, the value is copied. Effectively makes the
buffer options global to all buffers.
's' 'S' copy buffer options
no no when buffer created
yes no when buffer first entered (default)
no yes each time when buffer entered (vi comp.)
yes yes when buffer created or first entered
|
| t |
Search pattern for the tag command is remembered for
"n" command. Otherwise Vim only puts the pattern in
the history for search pattern, but doesn't change the
last used search pattern.
|
| x |
<Esc> on the command line executes the command line.
The default in Vim is to abandon the command line,
because <Esc> normally aborts a command. See <Esc>
|
| $ |
When making a change to one line, don't redisplay the
line, but put a '$' at the end of the changed text.
The changed text will be overwritten when you type the
new text. The line is redisplayed if you type any
command that moves the cursor from the insertion
point.
|
| % |
Vi-compatible matching is done for the "%" command.
Parens inside single and double quotes are also
counted, causing a string that contains a paren to
disturb the matching. For example, in a line like
"if (strcmp("foo(", s))" the first paren does not
match the last one. When this flag is not included,
parens inside single and double quotes are treated
specially. When matching a paren outside of quotes,
everyting inside quotes is ignored. When matching a
paren inside quotes, it will find the matching one (if
there is one). This works very well for C programs.
|
{'cpoptions' is not in Vi, of course}
-
| define (def) | string (default "^#[ \t]*define") |
- Pattern to be used to find a macro definition. It is a search
pattern, just like for the "/" command. The default value is for C
programs. This option is used for the commands like "[g" and
"[d". The 'isident' option is used to recognize the
identifier name after the match. See backslash option about
inserting backslashes to include a space or backslash. {not in Vi}
-
| dictionary (dict) | string (default "") |
- List of file names, separated by commas, that are used to lookup words
for keyword completion commands. Each file should
contain a list of words, one word per line. To include a comma in a
file name precede it with a backslash. Spaces after a comma are
ignored, otherwise spaces are included in the file name. See
backslash
option about using backslashes. {not in Vi}
-
| digraph (dg) | toggle (default off) |
- Enable the entering of digraphs in Insert mode with {char1} <BS>
{char2}. Only works if Vim was compiled with digraphs enabled. See
digraphs. {not in Vi} {Only when compiled with DIGRAPHS defined,
check with ":version"}
-
| directory (dir) | string (default for Amiga: ".,t:", for MS-DOS and Win32: ".,c:\tmp,c:\temp"
for Unix: ".,~/tmp,/tmp") |
- List of directory names for the swap file, separated with commas.
- The swap file will be created in the first directory where this is
possible.
- Empty means that no swap file will be used (recovery is
impossible!).
- A directory '.' means to put the swap file in the same directory as
the edited file. Everything after the "." is ignored, "./temp" is
handled in the same way as ".".
- Spaces after the comma are ignored, other spaces are considered part
of the directory name. To have a space at the start of a directory
name, precede it with a backslash.
- To include a comma in a directory name precede it with a backslash.
- A directory name may end in an ':' or '/'.
- Environment
variables are expanded.
- Careful with '\' characters, type one before a space, type two to
get one in the option (see backslash option), for example:
- :set dir=c:\\tmp,\ dir\\,with\\,commas,\\\ dir\ with\ spaces
- For backwards compatibility with Vim version 3.0 a '>' at the start
of the option is removed.
Using "." first in the list is recommended. This means that editing
the same file twice will result in a warning. Using "/tmp" on Unix is
discouraged, when the system crashes you lose the swap file. That is
why a "tmp" directory in your home directory is used first.
{Vi: directory to put temp file in, defaults to "/tmp"}
| edcompatible | toggle (default off) |
- Makes the 'g' and 'c' flags of the ":substitute" command to be
toggled each time the flag is given. See 11.3 complex_change. See
also 'gdefault' option.
-
| endofline (eol) | toggle (default on) |
- When writing a file and this option is off and the 'binary' option
is on, no end of line (newline) character will be written for the
last line in the file. This option is automatically set when
starting to edit a new file, unless the file does not have an end of
line (newline) for the last line in the file, in which case it is
reset. Normally you don't have to set or reset this option. When
'binary' is off the value is not used when writing the file. When
'binary' is on it is used to remember the presence of a newline for
the last line in the file, so that when you write the file the
situation from the original file can be kept. But you can change it
when you want to. Each buffer has its own copy of this option. {not in
Vi}
-
| equalalways (ea) | toggle (default on) |
- When on all the windows are automatically made the same size after
splitting or closing a window. When off, splitting a window will
reduce the size of the current window and leave the other windows the
same. When closing a window the extra lines are given the the window
above it. {not in Vi}
-
| equalprg (ep) | string (default "") |
- External program to use for "=" command. When this option is empty
the internal formatting functions are used ('lisp' or 'cindent').
Environment
variables are expanded. See option_backslash
about including spaces and backslashes. {not in Vi}
-
| errorbells (eb) | toggle (default off) |
- Ring the bell (beep or screen flash) for error messages. This only
makes a difference for error messages, the bell will be used always
for a lot of errors without a message (e.g. hitting in Normal
mode). See 'visualbell' on how to make the bell behave like a beep,
screen flash or do nothing.
-
| errorfile (ef) | string (default "AztecC.Err" or "errors.vim") |
- Name of the error file for the QuickFix mode (see 5.5
:make_makeprg). Environment variables are expanded. See
about including spaces and backslashes. {not in
Vi}
-
| errorformat (efm) | string (default is very long) |
- Scanf-like description of the format for the lines in the error file
(see 5.5 errorformat). {not in Vi}
-
| esckeys (ek) | toggle (default on) |
- Function keys that start with an <Esc> are recognized in Insert
mode. When this option is off, the cursor and function keys cannot be
used in Insert mode if they start with an <Esc>. The advantage of this
is that the single <Esc> is recognized immediately, instead of after
one second.
-
| expandtab (et) | toggle (default off) |
- In Insert mode: Use the appropriate number of spaces to insert a
<Tab>. Spaces are used in indents with the '>' and '<' commands and
when 'autoindent' is on. To insert a real tab when 'expandtab' is
on, use CTRL-V<Tab>. See also ":retab" command in 11.3
and section 4.3.4 expandtab. Each buffer has its own copy of
this option. {not in Vi}
-
- Enables the reading of .vimrc and .exrc in the current directory. If
you switch this option on you should also consider setting the
'secure' option (see 3.4 initialization). Using a local .exrc or
.vimrc is a potential security leak, use with care! {not in Vi}
-
| formatoptions (fo) | string (default "tcq") |
- This is a sequence of letters which describes how automatic
formatting is to be done. See format option table. Each buffer has its own
copy of this option. When the 'paste' option is on, no formatting is
done (like 'formatoptions' is empty). Commas can be inserted for
readability. {not in Vi}
-
| formatprg (fp) | string (default "") |
- The name of an external program that will be used to format the lines
selected with the "Q" command. The program must take the input on
stdin and produce the output on stdout. The Unix program 'fmt' is
such a program. If this option is an empty string, the internal
format function will be used C_indenting. Environment variables are
expanded. See backslash option about including spaces and
backslashes. {not in Vi}
-
| gdefault (gd) | toggle (default off) |
- When on, the ":substitute" flag 'g' is default on. This means that
all matches in a line are substituted instead of one. When a 'g' flag
is given to a ":substitute" command, this will toggle the substitution
of all or one match. See 11.3 complex_change. {not in Vi}
| command |
'gdefault' on |
'gdefault' off
|
| :s/// |
subst. all |
subst. one
|
| :s///g |
subst. one |
subst. all
|
| :s///gg |
subst. all |
subst. one
|
-
| guifont (gfn) | string (default "") |
- This is a list of fonts which should be tried when starting the GUI
version of vim. The fonts are separated with commas. Spaces after a
comma are ignored. To include a comma in a font name precede it with
a backslash. Setting an option requires an extra backslash before a
space and a backslash. See also option_backslash. For example:
- :set guifont=Screen15,\ 7x13,font\\,with\\,commas
will make vim try to use the font "Screen15" first, and if it fails
it will try to use "7x13" and then "font,with,commas" instead. If
none of the fonts can be loaded, vim will try using other resource
settings (for X, it will use the Vim.font resource), and finally it
will try some builtin default which should always be there ("7x13" in
the case of X). The font names given should be "normal" fonts. Vim
will try to find the related bold and italic fonts. {not in Vi}
-
| guioptions (go) | string (default "agmr") |
- This option only has an effect in the GUI version of vim. It is a
sequence of letters which describes what components and options of the
GUI should be used. Valid letters are as follows:
| 'a' |
If present, then whenever VISUAL mode is started, or the
Visual area extended, vim tries to become the owner of the
windowing system's global selection. This means that the
Visually highlighted text is available for pasting into other
applications as well as into vim itself. When the Visual mode
ends, possibly due to an operation on the text, or when an
application wants to paste the selection, the highlighted text
is automatically yanked into the <"*> GUI selection register.
Thus the selection is still available for pasting into other
applications after the VISUAL mode has ended.
If not present, then vim won't become the owner of the
windowing system's global selection unless explicitly told to
by selecting "Cut" or "Copy" etc from the "Edit" menu (which
have not been implemented yet!).
|
| 'f' |
Foreground: Don't use fork() to detatch the GUI from the shell
where it was started. Use this for programs that wait for the
editor to finish (e.g. an e-mail program). Altenatively you
can use "gvim -f" or ":gui -f" to start the GUI in the
foreground. gui_fork
|
| 'm' |
Include the menu bar (is currently ignored, there is always a
menu bar)
|
| 'g' |
Make menu items that are not active grey. If 'g' is not
included inactive menu items are not shown at all.
|
| 'r' |
Include the Right-hand scrollbar.
|
| 'l' |
Include the Left-hand scrollbarbox.
|
| 'b' |
Include the Bottom (horizontal) scrollbar.
|
And yes, you may even have scrollbars on the left AND the right if
you really want to :-). See gui_scrollbars for more information.
{not in Vi}
-
| guipty | toggle (default off) |
- Only in the GUI: If on, an attempt is made to open a pseudo-tty for
I/O to/from shell commands. See gui_pty. {not in Vi}
-
| helpfile (hf) | string (default (Amiga) "vim:vim_help.html"
(MS-DOS) "$VIM/vim_help.txt"
(Unix) "/usr/local/lib/vim/vim_help.txt") |
- Name of the help file. All help files should be placed together in
one directory. Environment
variables are expanded. For
example: "$VIM/doc/vim_help.txt". For MS-DOS $HOME is also tried, if
$VIM is not set. For Unix the default is adjusted at compile time to
where the help files are being installed. See option_backslash
about including spaces and backslashes. {not in Vi}
-
| helpheight (hh) | number (default 20) |
- Minimal initial height of the help window when it is opened with the
":help" command. The initial height of the help window is half of the
current window, or (when the 'ea' option is on) the same as other
windows. When the height is less than 'helpheight', the height is
set to 'helpheight'. Set to zero to disable. {not in Vi}
-
| hidden (hid) | toggle (default off) |
- When off the current buffer is unloaded when it is abandoned. When
on the current buffer becomes hidden when starting to edit another
buffer. If the current buffer is also displayed in another window it
does not become hidden. The commands that move through the buffer
list make the current buffer hidden although the 'hidden' option is
off. See also vim_win.html. {not in Vi}
-
| highlight (hl) | string (default "8b,db,es,hs,mb,Mn,nu,rs,sr,tb,vr,ws") |
- This option can be used to set highlighting mode for various
occasions. It is a comma separated list of character pairs. The first
character in a pair gives the occasion, the second the mode to use for
that occasion. The occasions are:
| 8 |
Meta & special keys listed with ":map"
|
| d |
directories in CTRL-D listing
|
| e |
error messages
|
| h |
help file headers
|
| m |
"--More--" message
|
| M |
Mode (e.g. "-- INSERT --")
|
| n |
line number for ":number" and ":#" commands
|
| r |
return to continue message and yes/no questions
|
| s |
status lines
|
| t |
Titles for output from ":set all", ":autocmd" etc.
|
| v |
Visual mode
|
| w |
warning messages
|
The display modes are:
| r |
reverse |
(termcap entry "mr" and "me")
|
| i |
italic |
(termcap entry "ZH" and "ZR")
|
| b |
bold |
(termcap entry "md" and "me")
|
| s |
standout |
(termcap entry "so" and "se")
|
| u |
underline |
(termcap entry "us" and "ue")
|
| n |
no highlighting
|
The default is used for occasions that are not included. {not in Vi}
-
| history (hi) | number (default 20) |
- A history of ":" commands, and a history of previous search patterns
are remembered. This option decides how many entries may be stored in
each of these histories (see Command line editing). {not in Vi}
-
| hkmap (kh) | toggle (default off) |
-
When on, the keyboard is mapped for the Hebrew character set.
Normally you would use CTRL-_ in insert mode to toggle this option.
Only applies if Vim was compiled with RIGHTLEFT. See vim_rlh.html.
{not in Vi}
| icon | toggle (default off, on when title can be restored) |
- When on the icon of the window will be set to the name of the file
currently being edited. Only the last part of the name is used. Only
works if the terminal supports setting window icons (currently only
Unix xterm and iris-ansi). When Vim was compiled with HAVE_X11
defined, the original icon will be restored if possible . {not
in Vi}
-
| ignorecase (ic) | toggle (default off) |
- Ignore case in search patterns. Also used when searching in the tags
file.
-
| include (inc) | string (default "^#[ \t]*include") |
- Pattern to be used to find an include command. It is a search
pattern, just like for the "/" command (See 6.6, "Pattern searches"). The default value is for C programs.
This option is used for the commands "[g", "]g", "[d", etc.. The
'isfname' option is used to recognize the file name that comes after
the matched pattern. See backslashes option about including spaces
and backslashes. {not in Vi}
-
| incsearch (is) | toggle (default off) |
- While typing a search pattern, show immediately where the so far
typed pattern matches. The matched string is highlighted. If the
pattern is invalid or not found, nothing is shown. The screen will
be updated often, this is only useful on fast terminals. {not in Vi}
-
| infercase (inf) | toggle (default off) |
- When doing keyword completion in insert mode, and
'ignorecase' is also on, the case of the match is adjusted. If the
typed text contains a lowercase letter where the match has an upper
case letter, the completed part is made lower case. If the typed text
has no lower case letters and the match has a lower case letter where
the typed text has an upper case letter, and there is a letter before
it, the completed part is made uppercase. Each buffer has his own
copy of this option. {not in Vi}
-
| insertmode (im) | toggle (default off) |
- Start the edit of a file in Insert mode. {not in Vi}
-
| isfname (isf) | string (default
for MS-DOS: "@,48-57,/,.,-,_,+,,,$,:,\"
for AMIGA: "@,48-57,/,.,-,_,+,,,$,:"
otherwise: "@,48-57,/,.,-,_,+,,,$,:,~")
|
- The characters given by this option are included in file names and
path names. File names are used for commands like "gf", "[i" and in
the tags file. Besides the characters in this option characters that
are defined by the C function isalpha() are also always included
(this depends on the character set and "locale"). {not in Vi}
The format of this option is a list of parts, separated with commas.
Each part can be a single character number or a range. A range is two
character numbers with '-' in between. A character number can be a
decimal number between 0 and 255 or the ASCII character itself (does
not work for digits). Example:
| "_,-,128-140,#-43" (include '_' and '-' and the range 128 to 140 and '#' to 43)
|
If a part starts with '^', the following character number or range
will be excluded from the option. The option is interpreted from left
to right. Put the excluded character after the range where it is
included. To include '^' itself use it as the last character of the
option or the end of a range. Example:
| "^a-z,#,^" |
(exclude 'a' to 'z', include '#' and '^')
|
If the character is '@', all characters where isalpha() returns TRUE
are included. Normally these are the characters a to z and A to Z,
plus accented characters. To include '@' itself use "@-@". Examples:
| "@,^a-z" |
All alphabetic characters, excluding lower
case letters.
|
| "a-z,A-Z,@-@" |
All letters plus the '@' character.
|
A comma can be included by using it where a character number is
expected. Example:
| "48-57,,,_" |
Digits, command and underscore.
|
A comma can be excluded by prepending a '^'. Example:
| " -~,^,,9" |
All characters from space to '~', excluding
comma, plus <Tab>.
|
See backslashe
option about including spaces and backslashes.
-
| isident (isi) | string (default for MS-DOS: "@,48-57,_,128-167,224-235" otherwise: "@,48-57,_,192-255") |
- The characters given by this option are included in identifiers.
Identifiers are used in recognizing environment variables and after
a match of the 'define' option. See 'isfname' for a description of the
format of this option. {not in Vi}
-
| isprint (isp) | string (default for MS-DOS: "@,~-255"
otherwise: "@,161-255") |
- The characters given by this option are displayed directly on the
screen. The characters from space (ascii 32) to '~' (ascii 126) are
always displayed directly, even when they are not included in
'isprint' or excluded. See 'isfname' for a description of the format
of this option. Non-printable characters are displayed with two
characters:
| 0 - 31 |
"^@" - "^_"
|
| 32 - 126 |
always single characters
|
| 127 |
"^?"
|
| 128 - 159 |
"~@" - "~_"
|
| 160 - 254 |
"| " - "|~"
|
| 255 |
"~?"
|
{not in Vi}
-
| iskeyword (isk) | string (default for MS-DOS: "@,48-57,_,128-167,224-235"
other systems: "@,48-57,_,192-255") |
- Keywords are used in searching and recognizing with many commands:
"*", "[i", etc. See 'isfname' for a description of the format of this
option. Each buffer has its own copy of this option. For C programs
you could use "a-z,A-Z,48-57,_,.,-,>". For a help file it is set to
all non-blank printable characters except '*', '"' and '|'. When the
'lisp' option is on the '-' character is always included. {not in Vi}
-
| joinspaces (js) | toggle (default on) |
- Insert two spaces after a period with a join command. {not in Vi}
-
| keywordprg (kp) | string (default "man") |
- Program to use for the "K" command. Environment variables are
expanded. When empty ":help" is used. See backslash option about
including spaces and backslashes. {not in Vi}
-
| langmap (lmap) | string (default "") |
- This option allows support for keyboards that have a mode for a
special language. The idea is that when you are typing text in Insert
mode your keyboard is switched in the special language mode, you get
different key codes for the special characters. When in command mode
the 'langmap' option takes care of translating these special
characters to the original meaning of the key. This means you don't
have to change the keyboard mode to be able to execute normal mode
commands.
- Example (for greek):
- :set langmap=ÁA,ÂB,ØC,ÄD,ÅE,ÖF,ÃG,ÇH,
ÉI,ÎJ,ÊK,ËL,ÌM,ÍN,ÏO,ÐP,QQ,ÑR,
ÓS,ÔT,ÈU,ÙV,WW,×X,ÕY,ÆZ,áa,âb,øc,äd,
åe,öf,ãg,çh,éi,îj,êk,ël,ìm,ín,ïo,ðp,qq,
ñr,ós,ôt,èu,ùv,òw,÷x,õy,æz
- Example (exchanges meaning of z and y for commands):
- :set langmap=zy,yz,ZY,YZ
The 'langmap' option is a list of parts, separated with commas. Each
part can be in one of two forms:
- A list of pairs. Each pair is a "from" character immediately
followed by the "to" character. Examples: "aA", "aAbBcC".
- A list of "from" characters, a semi-colon and a list of "to"
characters. Example: "abc;ABC"
Example: "aA,fgh;FGH,cCdDeE"
This will allow you to activate vim actions without having to switch
back and forth between the languages. Your language characters will be
understood as normal vim English characters (according to the langmap
mappings) in the following cases:
o Normal/Visual mode (commands, buffer/register names, user mappings)
o Insert/Replace Mode: Register names after CTRL-R
o Insert/Replace Mode: Mappings
Characters entered in Command line mode will NOT be affected by
this option. Note that this option can be changed at any time
allowing to switch between mappings for different languages/encodings.
Use a mapping to avoid having to type it each time!
Only included when Vim was compiled with HAVE_LANGMAP defined (Check
":version" for "+langmap"). {not in Vi}
-
| laststatus (ls) | number (default 1) |
- The value of this option influences when the last window will have a
status line:
0: never
1: only if there are at least two windows
2: always
The screen looks nicer with a status line if you have several
windows, but it takes another screen line. {not in Vi}
-
| linebreak (lbr) | toggle (default off) |
- If on Vim will wrap long lines at a character in 'breakat' rather
than at the last character that fits on the screen. Unlike 'wrapmargin'
and 'textwidth', this does not insert newline characters in the file,
it only affects the way the file is displayed, not its contents. The
value of 'showbreak' is used to put in front of wrapped lines.
This option is not used when the 'wrap' option is off. Note that <Tab>
characters after a line break are mostly not displayed correctly. {not
in Vi}
| lines | number (default 24 or terminal height) |
- Number of lines in the display. Normally you don't need to set this.
That is done automatically by the terminal initialization code. When
you do set this, and Vim is unable to change the physical number of
lines on the display, redisplaying may be wrong.
-
- Lisp mode: When a return is typed in insert mode set the indent for
the next line to Lisp standards (well, sort of). Also happens with
"cc" or "S". 'autoindent' must also be on for this to work. The '-'
character is included in keyword characters. Redefines the "="
operator to use this same indentation algorithm rather than calling an
external program if 'equalprg' is empty. Each buffer has its own copy
of this option. This option is reset when 'paste' is set. {Vi: Does
it a little bit differently} {Only when compiled with LISPINDENT
enabled, ":version" says "+lispindent" instead of "-lispindent"}
-
- List mode: Show tabs as CTRL-I, show end of line with $. Useful to
see the difference between tabs and spaces and for trailing blanks.
Each window has its own copy of this option.
-
- Changes the special characters that can be used in search patterns.
See section "Pattern searches".
-
| makeprg (mp) | string (default "make") |
- Program to use for the ":make" command. See :make_makeprg. This
option may contain '%' and '#' characters, which are expanded like
when used in a command line. Environment variables are expanded. See
backslash
option about including spaces and backslashes. {not in
Vi}
-
| maxmapdepth (mmd) | number (default 1000) |
- Maximum number of times a mapping is done without resulting in a
character to be used. This normally catches endless mappings, like
":map x y" with ":map y x". It still does not catch ":map g wg",
because the 'w' is used before the next mapping is done. See also
key_mapping {not in Vi}
-
| maxmem (mm) | number (default 512) |
- Maximum amount of memory (in Kbyte) to use for one buffer. When this
limit is reached allocating extra memory for a buffer will cause
other memory to be freed. See also 'maxmemtot'. {not in Vi}
-
| maxmemtot (mmt) | number (default 512) |
- Maximum amount of memory (in Kbyte) to use for all buffers together.
Added 'maxmemtot' option ( 'mmt' ), maximal Kbyte to use for
all buffers.
-
| modeline (ml) | toggle (default on) |
-
| modelines (mls) | number (default 5) |
- If 'modeline' is on 'modelines' gives the number of lines that is
checked for set commands. If 'modeline' is off or 'modelines' is 0 no
lines are checked. See 19.1 modeline. Each buffer has its own copy
of the 'modeline' option. 'modeline' is reset when 'compatible' is
set. 'modeline' is off by default when Vim is compiled with COMPATIBLE
defined. {not in Vi}
-
| modified (mod) | toggle (default off) |
- When on the buffer is considered to be modified. This option is set
by every command that makes a change to the buffer. Only the undo
command may reset it, when all changes have been undone. Every buffer
has its own copy of this option. {not in Vi}
-
- Listings pause when the whole screen is filled.
| Type <CR> or <NL> |
for one more line.
|
| Type <Space> |
for the next page.
|
| Type 'd' |
for down half a page.
|
| Type 'q' or CTRL-C |
to stop the listing.
|
| Type ':' |
to stop the listing and enter a command line.
|
Any other key causes the meaning of the keys to be displayed.
When this option is off there are no pauses, the listing continues
until finished. When Vim was compiled with COMPATIBLE defined this
option is default off. When 'compatible' is set this option is reset.
Note: The key typed at the "more" prompt is directly obtained from the
terminal, it is not mapped and typeahead is ignored. {not in Vi}
| mouse | string (default "", "a" for MS-DOS) |
- Enable the use of the mouse. Only works for certain terminals
(MS-DOS, Win32 and xterm). The mouse can be enabled for different
modes:
| n |
Normal mode
|
| v |
Visual mode
|
| i |
Insert mode
|
| c |
Command line mode
|
| h |
all previous modes when editing a help file
|
| a |
all previous modes
|
| r |
for "Hit return ..." question
|
Normally you would enable the mouse in all four modes with:
- :set mouse=a
Note: Normal copy/paste in an xterm can still be used by pressing the
shift key when the mouse is being used by Vim. See using mouse.
{not in Vi}
-
| mousetime (mouset) | number (default 500) |
- Only for GUI, MSDOS and xterm. Defines the maximum time in msec
between two mouse clicks for the second click to be recognized as a
multi click. {not in Vi}
-
| nestedcomments (ncom) | string (default ">") |
- A comma separated list of patterns that start comments that can be
nested. See format_comments. Each buffer has its own copy of this
option. {not in Vi}
-
| number (nu) | toggle (default off) |
- Print the line number in front of each line. Each window has its own
copy of this option. Tip: If you don't like wrapping lines to mix
with the line numbers, set the 'showbreak' option to eight spaces:
- :set showbreak=\ \ \ \ \ \ \ \
-
| paragraphs (para) | string (default "IPLPPPQPP LIpplpipbp") |
- Specifies the nroff macros that separate paragraphs. These are pairs
of two letters (see section 6.4 object_motions).
| paste | toggle (default off) |
- Put Vim in Paste mode. This is useful if you want to cut or copy
some text from one window and paste it in Vim. This will avoid
unexpected effects. When the 'paste' option is set:
- mapping in Insert mode is disabled
- abbreviations are disabled
- 'textwidth' is set to 0
- 'autoindent' is reset
- 'smartindent' is reset
- 'cindent' is reset
- 'lisp' is reset
- 'revins' is reset
- 'ruler' is reset
- 'showmatch' is reset
- 'formatoptions' is used like it is empty
When the 'paste' option is reset the mentioned options are restored to
the value before the moment 'paste' was set. Resetting 'paste' before
ever setting it does not have any effect. If you use this often, you
could map a function key to the command ":set invpaste^V^M". {not in
Vi}
-
| patchmode (pm) | string (default "") |
- When non-empty the oldest version of a file is kept. This can be used
to keep the original version of a file if you are changing files in a
source distribution. Only the first time that a file is edited a copy
of the original file will be kept. The name of the copy is the name
of the original file with the string in the 'patchmode' option
appended. This option should start with a dot. Use a string like
".org". 'backupdir' must not be empty for this to work (Detail: The
backup file is renamed to the patchmode file after the new file has
been succesfully written, that's why it must be possible to write a
backup file). If there was no file to be backed up, an empty file is
created. {not in Vi}
-
| path (pa) | string (default on Unix: ".,/usr/include,,"
other systems: ".,,") |
- This is a list of directories which will be searched when using the
gf, [f, ]f, ^Wf and other commands, provided that the file being
searched for has a relative path (not starting with '/'). The
directories in the 'path' option may be relative or absolute.
- Use commas to separate directory names:
- :set path=.,/usr/local/include,/usr/include
- Spaces can also be used to separate directory names (for backwards
compatibility with version 3.0). To have a space in a directory
name, precede it with an extra backslash:
- :set path=.,/dir/with\\ space
- To include a comma in a directory name precede it with an extra
backslash:
- :set path=.,/dir/with\\,comma
- To search relative to the directory where the current file is use
- :set path=.
- To search in the current directory use an empty string between two
commas:
- :set path=,,
- A directory name may end in a ':' or '/'.
- Environment
variables are expanded.
- Careful with '\' characters, type two to get one in the option:
- :set path=.,c:\\include
Or just use '/' instead:
- :set path=.,c:/include
Don't forget "." or files won't even be found in the same directory as
the file! {not in Vi}
-
| readonly (ro) | toggle (default off) |
- If on, writes fail unless you use an !. Protects you from
accidentally overwriting a file. Default on when Vim is started
in view mode ("vim -v") or when the executable is called "view".
Each buffer has its own copy of this option.
| remap | toggle (default on) |
- Allows for mappings to work recursively. If you do not want this for
a single entry, use the :noremap[!] command.
| report | number (default 2) |
- Threshold for reporting number of lines changed. When the number of
changed lines is more than 'report' a message will be given for most
":" commands. For the ":substitute" command the number of
substitutions is used instead of the number of lines.
-
| revins (ri) | toggle (default off) |
- Inserting characters in Insert mode will work backwards. See "typing backwards". When compiled with RIGHTLEFT (which is NOT
the default) this option can be toggled with the CTRL-B command in
Insert mode. This option is reset when 'compatible' or 'paste' is
set. {not in Vi}
-
| rightleft (rl) | toggle (default off) |
- When on, display orientation becomes right-to-left, i.e. character
that are stored in the file apear from the right to the left. Using
this option, it is possible to edit files for languages that are
written from the right to the left such as Hebrew and Arabic. This
option is per window, so it is possible to edit mixed files
simultaneously, or to view the same file in both ways (this is
sometimes usefull when editing Hebrew TeX--XeT files). It applies
only if Vim was compiled with RIGHTLEFT. See vim_rlh.html. {not in
Vi}
-
| ruler (ru) | toggle (default off) |
- Show the line and column number of the cursor position in the status
line, separated by a comma. If there are characters in the line that
take two positions on the screen, both the "real" column and the
screen column are shown, separated with a dash. For an empty line
"0-1" is shown. For an empty buffer the line number will also be
zero: "0,0-1". This option is reset when the 'paste' option is set.
If you don't want to see the ruler all the time but want to know where
you are, use "g_CTRL-G". {not in Vi}
| scroll | number (default 'lines' / 2) |
- Number of lines to scroll with CTRL-U and CTRL-D commands. Will be
set to half the number of lines in the window when the window size
changes. If you give a count to the CTRL-U or CTRL-D command it will
be used as the new value for 'scroll'. Reset to 'lines' / 2 with
":set scroll=0". Each window has its own copy of this option.
{difference from vi: 'scroll' gives the number of screen lines instead
of file lines, makes a difference when lines wrap}
-
| scrolljump (sj) | number (default 1) |
- Minimal number of lines to scroll when the cursor gets off the
screen (e.g. with "j"). Not used for scroll commands (e.g. CTRL-E,
CTRL-D). Useful if your terminal scrolls very slowly. {not in Vi}
-
| scrolloff (so) | number (default 0) |
- Minimal number of screen lines to keep above and below the cursor.
This will make some context visible around where you are working. If
you set it to a very large value (999) the cursor line will always be
in the middle of the window (except at the start or end of the file or
when long lines wrap). {not in Vi}
-
| sections (sect) | string (default "SHNHH HUnhsh") |
- Specifies the nroff macros that separate sections. These are pairs of
two letters (See section 6.4 object_motions).
| secure | toggle (default off) |
- When on, ":autocmd", shell and write commands are not allowed in
".vimrc" and ".exrc" in the current directory and map commands are
displayed. Switch it off only if you know that you will not run into
problems, or when the 'exrc' option is off. On Unix this option is
only used if the ".vimrc" or ".exrc" is not owned by you. This can be
dangerous if the systems allows users to do a "chown". You better set
'secure' at the end of your ~/.vimrc then.
-
| shell (sh) | string (default $SHELL or "sh", MS-DOS: "command") |
- Name of the shell to use for ! and :! commands. When changing the
value also check the 'shelltype', 'shellpipe' and 'shellredir'
options. It is allowed to give an argument to the command, e.g.
"csh -f". See option_backslash about including spaces and
backslashes. Environment
variables are expanded.
-
| shellpipe (sp) | string (default ">", "| tee", "|& tee" or "2>&1| tee") |
- String to be used to put the output of the ":make" command in the
error file. See also :make_makeprg. See
backslash
option about
including spaces and backslashes.
For the Amiga and MS-DOS the default is ">". The output is directly
saved in a file and not echoed to the screen.
For Unix the default it "| tee". The stdout of the compiler is saved
in a file and echoed to the screen. If the 'shell' option is "csh",
"tcsh" or "zsh" after initializations, the default becomes "|& tee".
If the 'shell' option is "sh", "ksh" or "bash" the default becomes
"2>&1| tee". This means that stderr is also included.
The initialization of this option is done after reading the ".vimrc"
and the other initializations, so that when the 'shell' option is set
there, the 'shellpipe' option changes automatically, unless it was
explicitly set before.
In the future pipes may be used for filtering and this option will
become obsolete (at least for Unix). {not in Vi}
-
| shellredir (srr) | string (default ">", ">&" or ">%s 2>&1") |
- String to be used to put the output of a filter in a temporary file.
See also :!. See backslash option about including spaces and
backslashes.
The name of the temporary file can be represented by %s if necessary
(the file name is appended automatically if no %s appears in the value
of this option).
The default is ">". For Unix, if the 'shell' option is "csh", "tcsh"
or "zsh" during initializations, the default becomes ">&". If the
'shell' option is "sh", "ksh" or "bash" the default becomes ">%s
2>&1". This means that stderr is also included.
The initialization of this option is done after reading the ".vimrc"
and the other initializations, so that when the 'shell' option is set
there, the 'shellredir' option changes automatically unless it was
explicitly set before.
In the future pipes may be used for filtering and this option will
become obsolete (at least for Unix). {not in Vi}
-
| shelltype (st) | number (default 0) |
- On the Amiga this option influences the way how the commands work
which use a shell.
0 and 1: always use the shell
2 and 3: use the shell only to filter lines
4 and 5: use shell only for ':sh' command
When not using the shell, the command is executed directly.
0 and 2: use 'shell -c cmd' to start external commands
1 and 3: use 'shell cmd' to start external commands
-
| shiftround (sr) | toggle (default off) |
- Round indent to multiple of 'shiftwidth'. Applies to > and < commands.
CTRL-T and CTRL-D in Insert mode always round the indent to a multiple
of 'shiftwidth' (this is vi compatible). {not in Vi}
-
| shiftwidth (sw) | number (default 8) |
- Number of spaces to use for each steop of (auto)indent. Each buffer
has its own copy of this option.
-
| shortmess (shm) | string (default "") |
- This option helps to avoid all the "Hit return" messages caused by
file messages, for example with CTRL-G, and to avoid some other
messages. It is a list of flags:
| flag |
meaning when present
|
| l |
use "999L, 888C" instead of "999 lines, 888 characters"
|
| m |
use "[+]" instead of "[Modified]"
|
| r |
use "[RO]" instead of "[readonly]"
|
| x |
use "[tx]" instead of "[textmode]" and "[notx]" instead of
"[notextmode]"
|
| f |
use "(3 of 5)" instead of "(file 3 of 5)"
|
| i |
use "[noeol]" instead of "[Incomplete last line]"
|
| n |
use "[New]" instead of "[New File]"
|
| a |
all of the above abbreviations
|
| o |
overwrite message for writing a file with subsequent message
for reading a file (useful for ":wn" or when 'autowrite' on)
|
| s |
don't give "search hit BOTTOM, continuing at TOP" or "search
hit TOP, continuing at BOTTOM" messages
|
| t |
trunctate file message at the start if it is too long to fit
on the command line, "<" will appear in the left most column.
|
This gives you the opportunity to avoid that a change between buffers
requires you to hit return, but still gives as useful a message as
possible for the space available. To get the whole message that you
would have got with 'shm' empty, use ":file!"
Useful values:
| shm= |
No abbreviation of message.
|
| shm=a |
Abbreviation, but no loss of information.
|
| shm=at |
Abbreviation, and truncate message when necessary.
|
{not in Vi}
-
| shortname (sn) | toggle (default off) |
- Filenames can be 8 characters plus one extension of 3 characters.
Multiple dots in file names are not allowed. When this option is on,
dots in filenames are replaced with underscores when adding an
extension (".~" or ".swp"). This option is not available for
MS-DOS, because then it would always be on. This option is useful
when editing files on an MS-DOS compatible filesystem, e.g. messydos
or crossdos. Each buffer has its own copy of this option. {not in
Vi}
-
| showbreak (sbr) | string (default "") |
- String to put at the start of lines that have been wrapped. Useful
values are "> " or "+++ ". Only printable characters are allowed,
excluding <Tab>. {not in Vi}
-
| showcmd (sc) | toggle (default on, off for Unix) |
- Show (partial) command in status line. Set this option off if your
terminal is slow. {not in Vi}
-
| showmatch (sm) | toggle (default off) |
- When a bracket is inserted, briefly jump to the matching one. The
jump is only done if the match can be seen on the screen.
A Beep is given if there is no match (no matter if the match can be
seen or not). This option is reset when the 'paste' option is set.
When the 'm' flag is not included in 'cpoptions', typing a character
will immediately move the cursor back to where it belongs.
-
| showmode (smd) | toggle (default on) |
-
If in Insert, Replace or Visual mode put a message on the last line.
Use the 'M' flag in 'highlight' to set the type of highlighting for
this message.
-
| sidescroll (ss) | number (default 0) |
- The minimal number of columns to scroll horizontally. Used only when
the 'wrap' option is off and the cursor is moved off of the screen.
When it is zero the cursor will be put in the middle of the screen.
When using a slow terminal set it to a large number or 0. When using
a fast terminal use a small number or 1. Not used for "zh" and "zl"
commands. {not in Vi}
-
| smartcase (scs) | toggle (default off) |
- Override the 'ignorecase' option if the search pattern contains upper
case characters. Only used when the search pattern is typed and
'ignorecase' option is on. Used for the commands "/", "?", "n", "N",
":g" and ":s". Not used for "*", "#", "gd", tag search, etc.. {not in
Vi}
-
| smartindent (si) | toggle (default off) |
- Do smart autoindenting when starting a new line. Works best for C
programs, but can also be used for other languages. 'cindent' does
something like this, works better in most cases, but is more strict,
see C_indenting. When 'cindent' is on setting 'si' has no effect.
Normally 'autoindent' should also be on when using 'smartindent'.
An indent is automatically inserted:
- After a line ending in '{'.
- After a line starting with a keyword from 'cinwords'.
- Before a line starting with '}' (only with the "O" command).
When typing '}' as the first character in a new line, that line is
given the same indent as the matching '{'.
When typing '#' as the first character in a new line, the indent for
that line is removed, the '#' is put in the first column. The indent
is restored for the next line. If you don't want this, use this
mapping: ":inoremap # X^H#", where ^H is entered with CTRL-V CTRL-H.
When using the ">>" command, lines starting with '#' are not shifted
right.
'smartindent' is reset when the 'paste' option is set. Each buffer
has its own copy of this option. {not in Vi} {Only when compiled with
SMARTINDENT defined, check with ":version"}
-
| smarttab (sta) | toggle (default off) |
- When on, a <Tab> in front of a line inserts 'shiftwidth' positions,
'tabstop' in other places. When off a <Tab> always inserts 'tabstop'
positions, 'shiftwidth' is only used for ">>" and the like. See also
section 4.3.4 expandtab. {not in Vi}
-
| splitbelow (sb) | toggle (default off) |
- When on, spliting a window will put the new window below the current
one. {not in Vi}
-
| startofline (sol) | toggle (default on) |
- When on the commands listed below move the cursor to the first
blank of the line. When off the cursor is kept in the same column
(if possible). This applies to the commands: CTRL-D, CTRL-U, CTRL-B,
CTRL-F, "G", "H", "M", "L", , and to the commands "d", "<<" and ">>"
with a linewise operator and with "%" with a count. This option is
set when the 'compatible' option is set. {not in Vi}
-
| suffixes (su) | string (default ".bak,~,.o,.h,.info,.swp") |
- Files with these suffixes are ignored when multiple files match a
wildcard. See suffixes. Commas can be used to separate the
suffixes. Spaces after the comma are ignored. A dot is also seen as
the start of a suffix. To include a dot or comma in a suffix, precede
it with a backslash (see backslash option about including spaces and
backslashes). {not in Vi}
-
| swapsync (sws) | string (default "sync") |
- When this option is not empty a swap file is synced to disk after
writing to it. This takes some time, especially on busy unix systems.
When this option is empty parts of the swap file may be in memory and
not written to disk. When the system crashes you may lose more work.
On Unix the system does a sync now and then without Vim asking for it,
so the disadvantage of setting this option off is small. On some
systems the swap file will not be written at all. For a unix system
setting it to "fsync" will use the fsync() call instead of sync(),
which may work better on some systems. {not in Vi}
-
| tabstop (ts) | number (default 8) |
- Number of spaces that a <Tab> in the file counts for. (See also
:retab command in 11.3). Each buffer has its own copy of
this option.
-
| taglength (tl) | number (default 0) |
- If non-zero, tags are significant up to this number of characters.
-
| tagrelative (tr) | toggle (default on) |
- If on and using a tag file in another directory, file names in that
tag file are relative to the directory where the tag file is. If Vim
was compiled with COMPATIBLE defined, or when the 'compatible' option
is set, this option is reset. {not in Vi}
| tags | string (default "./tags,tags") |
- Filenames for the tag command, separated by spaces or commas. To
include a space or comma in a filename, precede it with a backslash
(see backslash
option about including spaces and backslashes).
When a file name starts with "./", the '.' is replaced with the path
of the current file. Environment variables are expanded.
Also see tags_option.
When Vim was compiled with EMACS_TAGS defined Emacs-style tag files
are also supported. They are automatically recognized. The default
value becomes "./tags,./TAGS,tags,TAGS". If ":version" shows
"+emacs_tags" then the Emacs tags support is included. {Vi: default
is "tags /usr/lib/tags"}
| term | string (default is $TERM, if that fails:
on Unix: "ansi"
on Amiga: "amiga"
on MS-DOS: "pcterm"
on Win 32: "win32")
|
- Name of the terminal. Used for choosing the terminal control
characters. Environment
variables are expanded.
For Example:
- :set term=$TERM
See termcap.
| terse | toggle (default off) |
- When set: Add 's' flag to 'shortmess' option (this makes the message
for a search that hits the start or end of the file not being
displayed). When reset: Remove 's' flag from 'shortmess' option. {Vi
shortens a lot of messages}
-
| textauto (ta) | toggle (default on) |
- When a new file is edited the first line is checked for the line
separator. If it is a single <NL> 'textmode' is reset. If it is a
<CR><NL> pair 'textmode' is set. {not in Vi}
-
| textmode (tx) | toggle (MS-DOS: default on, others: default off) |
- When off, <NL> separates lines. When on, <CR><NL> separates lines
and CTRL-Z at end of file is ignored. Only used when reading and
writing files. Set automatically when reading a file and 'textauto'
is on. Each buffer has its own copy of this option. {not in Vi}
-
| textwidth (tw) | number (default 0) |
- Maximum width of text that is being inserted. A longer line will be
broken after white space to get this width. A zero value disables
this. 'textwidth' is set to 0 when the 'paste' option is set. When
'textwidth' is zero, 'wrapmargin' may be used. See also
'formatoptions' and ins_textwidth. Each buffer has its own copy of
this option. {not in Vi}
-
| tildeop (to) | toggle (default off) |
- The tilde command "~" behaves like an operator. {not in Vi}
| timeout | toggle (default on) |
| ttimeout | toggle (default off) |
- These two options together determine the behaviour when part of a
mapped key sequence or keyboard code has been received:
| timeout |
ttimeout |
action
|
| off |
off |
no time out
|
| on |
on or off |
time out on :mappings and key codes
|
| off |
on |
time out on key codes
|
If there is no time out, Vim will wait until either the complete
mapping or key sequence has been received, or it is clear that there
is no mapping or key sequence for the received characters. For
example: if you have mapped "vl" and Vim has received 'v', the next
character is needed to see if the 'v' is followed by an 'l'. With a
time out Vim will wait for about 1 second for the next character to
arrive. After that the already received characters are interpreted
as single characters. The time can be given with the 'timeoutlen'
option.
On slow terminals or very busy systems time out may cause
malfunctioning cursor keys. If both options are off, Vim waits
forever after an entered <Esc> if there are key codes that start
with <Esc>. You will have to type <Esc> twice. If you do not have
problems with key codes, but would like to have :mapped key
sequences not time out in 1 second, set the ttimeout option and
reset the timeout option. {the ttimeout option is not in Vi}
-
| timeoutlen (tm) | number (default 1000) |
- The time in milliseconds that is waited for a key code or mapped key
sequence to complete. {only in some versions of Vi}
| title | toggle (default off, on when title can be restored) |
- When on the title of the window will be set to "VIM - filename",
where filename is the name of the file currently being edited. Only
works if the terminal supports setting window titles (currently Amiga
console, Unix xterm and iris-ansi).
When Vim was compiled with HAVE_X11 defined, the original title will be
restored if possible. The output of ":version" will include "+X11"
when HAVE_X11 was defined, otherwise it will be "-X11". This also
works for the icon name 'icon'.
If the title cannot be restored, it is set to "Thanks for flying Vim".
You will have to restore the title outside of Vim then. When using an
xterm from
a remote machine you can use this command:
- rsh machine_name xterm -display $DISPLAY &
then the WINDOWID environment variable should be inherited and the
title of the window should change back to what it should be after
exiting Vim (rather than using the "Thanks..." message). {not in
Vi}
-
| ttybuiltin (tbi) | toggle (default on) |
- When on, the builtin termcaps are searched before the external ones.
When off the builtin termcaps are searched after the external ones.
When this option is changed, you should set the 'term' option next for
the change to take effect, for example:
- :set notbi term=$TERM
See also termcap. {not in Vi}
-
| ttyfast (tf) | toggle (default off, on when 'term' is xterm, hpterm,
sun-cmd, dtterm or iris-ansi)
|
- Indicates a fast terminal connection. More characters will be sent to
the screen for redrawing, instead of using insert/delete line
commands. Improves smoothness of redrawing when there are multiple
windows and the terminal does not support a scrolling region. {not in
Vi}
-
| ttyscroll (tsl) | number (default 999) |
- Maximum number of lines to scroll the screen. If there are more lines
to scroll the window is redrawn. For terminals where scrolling is
very slow and redrawing is not slow this can be set to a small number,
e.g. 3, to speed up displaying.
-
| undolevels (ul) | number (default 100, for Unix 1000) |
- Maximum number of changes that can be undone. Set to 0 for Vi
compatibility: one level of undo and 'u' undoes itself. Set to a
negative number for no undo at all (saves memory). {not in Vi}
-
| updatecount (uc) | number (default 200) |
- After typing this many characters the swap file will be written to
disk. When zero no swap file will be created at all (see chapter on recovery). 'updatecount' is set to zero by starting
Vim with the "-n" option, see starting. When editing in readonly
mode this option will be initialized to 10000. Also see 'swapsync'.
{not in Vi}
-
| updatetime (ut) | number (default 4000) |
- If this many milliseconds nothing is typed the swap file will be
written to disk (see chapter on recovery). {not in
Vi}
-
| viminfo (vi) | string (default "") |
- When non-empty, the viminfo file is read upon startup and written
when exiting Vim (see viminfo_file). The string should be a comma
separated list of parameters, each consisting of a single character
identifying the particular parameter, followed by a number or string
which specifies the value of that parameter. If a particular
character is left out, then the default value is used for that
parameter. The following is a list characters and their meanings.
| char |
value
|
| ' |
Maximum number of previously edited files for which
the marks are remembered. This parameter must always
be included when 'viminfo' is non-empty.
|
| f |
Whether file marks need to be stored. If zero, file
marks ('0 to '9, 'A to 'Z) are not stored. When not
present or when non-zero, they are all stored. '0 is
used for the current cursor position (when exiting or
when doing ":wviminfo").
|
| r |
Removable media. The argument is a string (up to the
next ','). This parameter can be given several times.
Each specifies the start of a path for which no marks
will be stored. This is to avoid removable media.
For MS-DOS you could use "ra:,rb:", for Amiga
"rdf0:,rdf1:,rdf2:". Case is ignored. Maximum length
is 50 characters.
|
| " |
Maximum number of lines saved for each register. If
zero then registers are not saved. If no number given
all lines are saved. Dont forget to put a backslash
before the ", otherwise it will be recognized as the
start of a comment!
|
| : |
Maximum number of items in the command-line history to
be saved. Default: value of 'history'.
|
| / |
Maximum number of items in the search pattern history
to be saved. If non-zero, then the previous search
and substitute patterns are also saved. Default:
value of 'history'.
|
Example:
- :set viminfo='50,\"1000,:0
means that marks will be remembered for the last 50 files you edited,
contents of registers (up to 1000 lines each) will be remembered,
command line history will not be saved, and since '/' is not
specified, the default will be used, that is, save all of the search
history, and also the previous search and substitute patterns.
{not in Vi} {only available when Vim was compiled with VIMINFO
defined, use ":version" to check this}
-
| visualbell (vb) | toggle (default off) |
- Use visual bell instead of beeping. The terminal code to display the
visual bell is given with 't_vb'. When no beep of flash is wanted,
Does not work on the Amiga, you always get a screen flash. use ":set
vb t_vb=". Also see 'errorbells'. {not in Vi}
-
- Give a warning message when a shell command is used while the buffer
has been changed.
-
| weirdinvert (wi) | toggle (default off) |
- Set this option for terminals that have a weird inversion method.
Makes the start/end invert code outputted before every character.
Slows down terminal I/O a lot, but it makes Visual mode work.
{not in Vi}
-
| whichwrap (ww) | string (default "b,s") |
- Allow specified keys that move the cursor left/right to wrap to the
previous/next line when the cursor is on the first/last character in
the line. Concatenate characters to allow this for these keys:
| char |
key |
mode
|
| b |
<BS> |
Normal and Visual
|
| s |
<Space> |
Normal and Visual
|
| h |
"h" |
Normal and Visual
|
| l |
"l" |
Normal and Visual
|
| < |
<Left> |
Normal and Visual
|
| > |
<Right> |
Normal and Visual
|
| [ |
<Left> |
Insert and Replace
|
| ] |
<Right> |
Insert and Replace
|
For example:
- ":set ww=<,>,[,]"
allows wrap only when cursor keys are used.
When the movement keys are used in combination with a delete or change
operator, the newline also counts for a character. This makes "3h"
different from "3dh" when the cursor crosses the end of a line. This
is also true for "x" and "X", because they do the same as "dl" and
"dh". If you use this, you may also want to use the mapping ":map <BS>
X" to make backspace delete the character in front of the cursor. When
compiled with COMPATIBLE defined or when 'compatible' is set,
'whichwrap' is set to "". {not in Vi}
-
| wildchar (wc) | number (default <Tab> or CTRL-E) |
- Character you have to type to start wildcard expansion in the
command line. CTRL-E is used when Vim was compiled with COMPATIBLE
or when the 'compatible' option is set. The character is not
recognized when used inside a macro. Although 'wc' is a number option,
you can set it to a special key: ":set wc=<Esc>". {not in Vi}
-
| winheight (wh) | number (default 0) |
- Minimal number of lines for the current window. If the current
window is smaller, its size is increased, at the cost of the height
of other windows. Set it to 999 to make the current window always
fill the screen. Set it to a small number for normal editing. The
height is not adjusted after one of the commands to change the
height of the current window. {not in Vi}
-
- When on, lines longer than the width of the window will wrap and
displaying continues on the next line. When off lines will not wrap
and only part of long lines will be displayed. When the cursor is
moved to a part that is not shown, the screen will scroll horizontally
(also see 'sidescroll' option and wrap_off). Each window has its
own copy of this option. If you want to break long lines, see
'textwidth'. {not in Vi}
-
| wrapmargin (wm) | number (default 0) |
- Number of characters from the right window border where wrapping
starts. When typing text beyond this limit, a newline will be
inserted and inserting continues on the next line. When 'textwidth'
is non-zero, this option is not used. See also 'formatoptions' and
ins_textwidth. Each buffer has its own copy of this option. {Vi:
works differently and less useful}
-
| wrapscan (ws) | toggle (default on) |
- Searches wrap around the end of the file.
-
| writeany (wa) | toggle (default off) |
- Allows writing to any file with no need for "!" override.
-
| writebackup (wb) | toggle (default on, unless compiled with WRITEBACKUP not defined) |
- Make a backup before overwriting a file. The backup is removed after
the file was successfully written, unless the 'backup' option is
also on. Reset this option if your file system is almost full. See
the table in section 5.4 for another explanation backup_table.
{not in Vi}
-
| writedelay (wd) | number (default 0) |
- The number of microseconds to wait for each character sent to the
screen. When non-zero, characters are sent to the terminal one by
one. For MS-DOS pcterm this does not work. For debugging purposes.
{not in Vi}
Part 1
Part 2
Part 3
Part 4
Part 5
Part 6
Part 7
Part 8
Part 9
Send feedback on this page to Rajesh Kallingal
For Vim version 3.24. Last modification: 1996 Apr 25
|