options.txt - html version
options.txt - html version
*options.txt* For Vim version 5.3. Last modification: 1998 Aug 29
VIM REFERENCE MANUAL by Bram Moolenaar
Options *options*
1. Setting options |set-option|
2. Automatically setting options |auto-setting|
3. Saving settings |save-settings|
4. Options summary |option-summary|
For an overview of options see help.txt |option-list|.
Vim has a number of internal variables and switches which can be set to
achieve special effects. These options come in three forms:
boolean can only be on or off *boolean* *toggle*
number has a numeric value
string has a string value
1. Setting options *set-option*
*:se* *:set*
: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] all& Set all options, except terminal options, to their
default value. The values of 'term', 'lines' and
'columns' are not changed {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 |cmdline-completion|.
See |option-backslash| for using backslashes in
{value}.
:se[t] {option}+={value} *:set+=*
Add the {value} to a number option, or concatenate the
{value} to a string option. When the option is a
comma separated list, a comma is added, unless the
value was empty.
:se[t] {option}^={value} *:set^=*
Multiply the {value} to a number option, or
prepend the {value} to a string option. When the
option is a comma separated list, a comma is added,
unless the value was empty.
:se[t] {option}-={value} *:set-=*
Subtract the {value} from a number option, or remove
the {value} from a string option, if it is there.
If the {value} is not found in a string option, there
is no error or warning. When the option is a comma
separated list, a comma is deleted, unless the option
becomes empty.
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 following arguments will be ignored.
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-prompt|.
*option-backslash*
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.
*add-option-flags* *remove-option-flags*
Some options are a list of flags. When you want to add a flag to such an
option, without changing the existing ones, you can do it like this:
:set guioptions+=a
Remove a flag from an option like this:
:set guioptions-=a
This removes the 'a' flag from 'guioptions'.
*:set_env* *expand-env* *expand-environment-var*
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,.
*$HOME*
Using "~" is like using "$HOME", but it is only recognized at the start of an
option and after a space or comma.
On Unix systems "~user" can be used too. It is replaced by the home directory
of user "user". Example:
:set path=~mool/include,/usr/include,.
On Unix systems the form "${HOME}" can be used too. The name between {} can
contain non-id characters then. Note that if you want to use this for the
"gf" command, you need to add the '{' and '}' characters to 'isfname'.
*$VIM*
The environment variable "$VIM" is used to locate various support files, such
as the on-line documentation and files used for syntax highlighting. For
example, the main help file is normally "$VIM/doc/help.txt".
To avoid the need for every user to set the $VIM environment variable, Vim
will try to get the value for $VIM in this order:
1. The value defined by the $VIM environment variable. You can use this to
make Vim look in a specific directory for its support files. Example:
setenv VIM /home/paul/vim
2. For MSDOS and Win32 the environment variable $HOME is used, when defined.
Works just like setting the $VIM environment variable.
3. The path from 'helpfile' is used, unless it contains some environment
variable too (the default is "$VIM/doc/help.txt": chicken-egg problem).
The file name ("help.txt" or any other) is removed. If it then ends in
"/doc", this is removed too.
4. For MSDOS, Win32 and OS/2 Vim tries to use the directory name of the
executable. If it ends in "/src", this is removed. This is useful if you
unpacked the .zip file in some directory, and adjusted the search path to
find the vim executable.
5. For Unix the compile-time defined installation directory is used (see the
output of ":version").
Note the maximum length of an expanded option is limited. How much depends on
the system, mostly it is something like 256 or 1024 characters.
*:fix* *:fixdel*
: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:
:if &term == "termname"
: set t_kb=^V<BS>
: fixdel
:endif
Where "^V" is CTRL-V and "<BS>" is the backspace key
(don't type four characters!). Replace "termname"
with your terminal name.
If your <Delete> key sends a strange key sequence (not
CTRL-? or CTRL-H) you cannot use ":fixdel". Then use:
:if &term == "termname"
: set t_kD=^V<Delete>
:endif
Where "^V" is CTRL-V and "<Delete>" is the delete key
(don't type eight characters!). Replace "termname"
with your terminal name.
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
2. Automatically setting options *auto-setting*
Besides changing options with the ":set" command, there are three alternatives
to set options automatically for one or more files:
1. When starting Vim initializations are read from various places. See
|initialization|. Most of them are performed for all editing sessions,
and some of them depend on the directory where Vim is started.
2. 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 |autocommand|.
3. 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. This is explained here.
*modeline*
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 (<Space> or <Tab>)
{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 (<Space> or <Tab>)
{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).
3. Saving settings *save-settings*
*:mk* *:mkexrc*
: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* *:mkvimrc*
: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}
*:mks* *:mksession*
:mks[ession][!] [file] Like :mkvimrc, but write commands to the end of the
file that reload the files being edited at the time of
the command. {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',
'modified', 'scroll', 'term' and 'ttyfast' are not included, because these are
terminal or file dependent. Note that the options 'binary', 'fileformat',
'paste' and 'readonly' are included, this might not always be what you want.
When special keys are used in mappings, The 'cpoptions' option will be
temporarily made empty, to avoid the mappings to be misinterpreted. This
makes the file incompatible with Vi, but makes sure it can be used with
different terminals.
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 |autocommand| and/or modelines |modeline|.
If you only want to add a single option setting to your vimrc, you can use
these steps:
1. Edit your vimrc file with Vim.
2. Play with the option until it's right. E.g., try out different values for
'guifont'.
3. Append a line to set the value of the option, using the expression register
'=' to enter the value. E.g., for the 'guifont' option:
o:set guifont=<C-R>=&guifont<CR><Esc>
[<C-R> is a CTRL-R, <CR> is a return, <Esc> is the escape key]
Note that when you create a .vimrc file, this can influence the 'compatible'
option, which has several side effects. See |'compatible'|.
":mkvimrc", ":mkexrc" and ":mksession" write the command to set or reset the
'compatible' option to the output file first, because of these side effects.
The output of ":mksession" is the same as ":mkvimrc", but additional commands
are added to the file. This depends on the 'sessionoptions' option. The
resulting file, when executed with a ":source" command:
1. Restores mappings and options, if 'sessionoptions' contains "options".
2. Unloads all currently loaded buffers.
3. Restores the working directory.
4. Restores screen height, if 'sessionoptions' contains "resize".
5. Reloads the files you were editing, at the lines where you left them.
6. Restores windows, if 'sessionoptions' contains "winsize".
If the Vim window size has been restored or is already the same as in the
loaded session, the window sizes are restored exactly. Otherwise, the
windows are just given sensible sizes
7. If a file exists with the same name as the session file, but ending in
"x.vim" (for eXtra), executes that as well. You can use x.vim files to
specify additional settings and actions associated with a given session,
such as creating menu items in the GUI version.
You can thus use session files to quickly switch between different projects,
automatically loading the files you were last working on in that project.
The full filename of your current session is available in the internal
variable "this_session". See |this_session-variable|.
So an example mapping might be (all one line):
:nmap <S-F1> :wa | execute("mksession " . this_session)<CR>:so $VIM/sessions/
which saves the files and session, and starts off the command to load another.
4. Options summary *option-summary*
In the list below all the options are mentioned with their full name and with
an abbreviation if there is one. Both forms may be used.
In this document when a boolean option is "set" that means that ":set option"
is entered. When an option is "reset", ":set nooption" is used.
For some options there are two default values: The "Vim default", which is
used when 'compatible' is not set, and the "Vi default", which is used when
'compatible' is set.
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 'textwidth' option can be 78 for a normal text file and 0 for a C
program.
global one option for all buffers and windows
local to window each window has its own copy of this option
local to buffer each buffer has its own copy of this option
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 |X_op|.
*'aleph'* *'al'*
'aleph' 'al' number (default 128 for MS-DOS, 224 otherwise)
global
{not in Vi}
{only available when compiled with the |+rightleft|
feature}
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.
See |rightleft.txt|.
*'allowrevins'* *'ari'* *'noallowrevins'* *'noari'*
'allowrevins' 'ari' boolean (default off)
global
{not in Vi}
{only available when compiled with the |+rightleft|
feature}
Allow CTRL-_ in Insert and Command-line mode. This is default off, to
avoid that users that accidentally type CTRL-_ instead of SHIFT-_ get
into reverse Insert mode, and don't know how to get out. See
'revins'. This option is reset when 'compatible' is set.
*'altkeymap'* *'akm'* *'noalkeymap'* *'noakm'*
'altkeymap' 'akm' boolean (default off)
global
{not in Vi}
{only available when compiled with the |+farsi|
feature}
When on, the second language is Farsi. In editing mode CTRL-_ toggles
the keyboard map between Farsi and English, when 'allowrevins' set.
When off, the keyboard map toggles between Hebrew and English. This
is useful to start the vim in native mode i.e. English (left-to-right
mode) and have default second language Farsi or Hebrew (right-to-left
mode). See |farsi.txt|.
*'autoindent'* *'ai'* *'noautoindent'* *'noai'*
'autoindent' 'ai' boolean (default off)
local to buffer
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 "gq" 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}.
*'autowrite'* *'aw'* *'noautowrite'* *'noaw'*
'autowrite' 'aw' boolean (default off)
global
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.
*'background'* *'bg'*
'background' 'bg' string (default "dark" or "light")
global
{not in Vi}
When set to "dark", Vim will try to use colors that look good on a
dark background. When set to "light", Vim will try to use colors that
look good on a light background. Any other value is illegal.
Vim tries to set the default value according to the terminal used.
This will not always be correct.
When starting the GUI, the default value for 'background' will be
"light". When the value is not set in the .gvimrc, and Vim detects
that the background is actually quite dark, 'background' is set to
"dark". But this happens only AFTER the .gvimrc file has been read
(because the window needs to be opened to find the actual background
color). To get around this, force the GUI window to be opened by
putting a ":gui" command in the .gvimrc file, before where the value
of 'background' is used (e.g., before ":syntax on").
For the Win32 GUI, setting 'background' before starting the GUI, will
change the background and foreground colors to lightgrey on black or
black on white. On other systems setting 'background' does not
change the foreground or background colors.
Normally this option would be set in the .vimrc file. Possibly
depending on the terminal name. Example:
if &term == "pcterm"
set background=dark
endif
When this option is set, the default settings for the highlight groups
will change. To use other settings, place ":highlight" commands AFTER
the setting of the 'background' option.
This option is also used in the "$VIM/syntax/syntax.vim" file to
select the colors for syntax highlighting. After changing this
option, you must load syntax.vim again to see the result. This can be
done with ":syntax on".
*'backspace'* *'bs'*
'backspace' 'bs' number (default 0)
global
{not in Vi}
Influences the working of <BS>, <Del>, CTRL-W and CTRL-U in Insert
mode:
value effect
0 Vi compatible backspacing is used.
1 allow backspacing over <EOL>s.
2 allow backspacing over the start of insert. 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.
*'backup'* *'bk'* *'nobackup'* *'nobk'*
'backup' 'bk' boolean (default off)
global
{not in Vi}
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| for more explanations.
*'backupdir'* *'bdir'*
'backupdir' 'bdir' string (default for Amiga: ".,t:",
for MS-DOS and Win32: ".,c:/tmp,c:/temp"
for Unix: ".,~/tmp,~/")
global
{not in Vi}
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.
- A directory starting with "./" (or ".\" for MS-DOS et.al.) means to
put the backup file relative to where the edited file is. The
leading "." is replaced with the path name of the edited file.
- 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 |:set_env|.
- Careful with '\' characters, type one before a space, type two to
get one in the option (see |option-backslash|), 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.
The use of |:set+=| and |:set-=| is preferred when adding or removing
directories from the list. This avoids problems when a future version
uses another default.
*'backupext'* *'bex'*
'backupext' 'bex' string (default "~", for VMS: "_")
global
{not in Vi}
String which is appended to a file name to make the name of the
backup file. The default is quite unusual, because this avoids
accidentally 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.
*'binary'* *'bin'* *'nobinary'* *'nobin'*
'binary' 'bin' boolean (default off)
local to buffer
{not in Vi}
This option should be set before editing a binary file. You can also
use the "-b" Vim argument. When this option is switched on a few
options will be changed (also when it already was on):
'textwidth' will be set to 0
'wrapmargin' will be set to 0
'modeline' will be off
'expandtab' will be off
Also, 'fileformat' and 'fileformats' options will not be used, the
file is read and written like 'fileformat' was "unix" (a single <NL>
separates lines).
NOTE: When you start editing a(nother) file while the 'bin' option is
on, settings from autocommands may change the settings again (e.g.,
'textwidth'), causing trouble when editing. You might want to set
'bin' again when the file has been loaded.
The previous values of these options are remembered and restored when
'bin' is switched from on to off. Each buffer has its own set of
saved option values.
When writing a file the <EOL> for the last line is only written if
there was one in the original file (normally Vim appends an <EOL> to
the last line if there is none; this would make the file longer). See
the 'endofline' option.
*'bioskey'* *'biosk'* *'nobioskey'* *'nobiosk'*
'bioskey' 'biosk' boolean (default on)
global
{not in Vi} {only for MS-DOS}
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.
*'breakat'* *'brk'*
'breakat' 'brk' string (default " ^I!@*-+_;:,./?")
global
{not in Vi}
This option lets you choose which characters might cause a line
break if 'linebreak' is on.
*'browsedir'* *'bsdir'*
'browsedir' 'bsdir' string (default for "last")
global
{not in Vi} {only for Motif and Win32 GUI}
Which directory to use for the file browser:
last Use same directory as with last file browser.
buffer Use the directory of the related buffer.
current Use the current directory.
*'cindent'* *'cin'* *'nocindent'* *'nocin'*
'cindent' 'cin' boolean (default off)
local to buffer
{not in Vi}
{not available when compiled without the |+cindent|
feature}
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|. This option is switched off
when 'paste' is set. When you don't like the way 'cindent' works, try
the 'smartindent' option.
'cinkeys' 'cink' string (default "0{,0},:,0#,!^F,o,O,e")
local to buffer
{not in Vi}
{not available when compiled without the |+cindent|
feature}
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|.
*'cinoptions'* *'cino'*
'cinoptions' 'cino' string (default "")
local to buffer
{not in Vi}
{not available when compiled without the |+cindent|
feature}
The 'cinoptions' affect the way 'cindent' reindents lines in a C
program. See |cinoptions-values| for the values of this option, and
|C-indenting| for info on C indenting in general.
*'cinwords'* *'cinw'*
'cinwords' 'cinw' string (default "if,else,while,do,for,switch")
local to buffer
{not in Vi}
{not available when compiled without both the
|+cindent| and the |+smartindent| features}
These keywords start an extra indent in the next line when
'smartindent' or 'cindent' is set. For 'cindent' this is only done at
an appropriate place (inside {}).
*'cmdheight'* *'ch'*
'cmdheight' 'ch' number (default 1)
global
{not in Vi}
Number of lines to use for the command-line. Helps avoiding
|hit-return| prompts.
*'columns'* *'co'*
'columns' 'co' number (default 80 or terminal width)
global
{not in Vi}
Number of columns of the screen. Normally this is set by the terminal
initialization and does not have to be set by hand.
*'comments'* *'com'*
'comments' 'com' string (default
"sr:/*,mb:*,el:*/,://,b:#,:%,:XCOMM,n:>,fb:-")
local to buffer
{not in Vi}
A comma separated list of strings that can start a comment line. See
|format-comments|. See |option-backslash| about using backslashes to
insert a space.
*'compatible'* *'cp'* *'nocompatible'* *'nocp'*
'compatible' 'cp' boolean (default on, off when a .vimrc file is found)
global
{not in Vi}
This option has the function of making Vim either more Vi-compatible,
or behave in a more useful way. This is a special kind of option,
because when it's set or reset, other options are also changed as a
side effect. CAREFUL: Setting or resetting this option can have a lot
of unexpected effects: Mappings are interpreted in another way, undo
behaves differently, etc.
By default this option is on and the Vi defaults are used for the
options. This default was chosen for those people who want to use Vim
just like Vi, and don't even (want to) know about the 'compatible'
option.
When a ".vimrc" file is found while Vim is starting up, this option is
switched off, and all options that have not been modified will be set
to the Vim defaults. Effectively, this means that when a ".vimrc"
file exists, Vim will use the Vim defaults, otherwise it will use the
Vi defaults. Also see |compatible-default|.
You can also set this option with the "-C" argument, and reset it with
"-N". See |-C| and |-N|.
Switching this option off makes the Vim defaults be used for options
that have a different Vi and Vim default value. See the options
marked with a '+' below. Other options are not modified.
At the moment this option is set, several other options will be set
or reset to make Vim as Vi-compatible as possible. See the table
below. This can be used if you want to revert to Vi compatible
editing.
See also 'cpoptions'.
option + set value effect
'allowrevins' off no CTRL-_ command
'backspace' 0 normal backspace
'backup' off no backup file
'cindent' off no C code indentation
'cpoptions' + (all flags) Vi-compatible flags
'digraph' off no digraphs
'esckeys' + off no <Esc>-keys in Insert mode
'expandtab' off tabs not expanded to spaces
'fileformats' + "" no automatic file format detection,
"dos,unix" except for DOS, Windows and OS/2
'formatoptions' + "vt" Vi compatible formatting
'gdefault' off no default 'g' flag for ":s"
'history' + 0 no commandline history
'hlsearch' off no highlighting of search matches
'incsearch' off no incremental searching
'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
'smartcase' off no automatic ignore case switch
'smartindent' off no smart indentation
'smarttab' off no smart tab size
'softtabstop' 0 tabs are always 'tabstop' positions
'startofline' on goto startofline with some commands
'tagrelative' + off tag file names are not relative
'textauto' + off no automatic textmode detection
'textwidth' 0 no automatic line wrap
'tildeop' off tilde is not an operator
'ttimeout' off no terminal timeout
'whichwrap' + "" left-right movements don't wrap
'wildchar' + CTRL-E only when the current value is <Tab>
use CTRL-E for cmdline completion
*'complete'* *'cpt'*
'complete' 'cpt' string (default: ".,b")
global
{not in Vi}
This option specifies how keyword completion |ins-completion| works
when CTRL-P or CTRL-N are used. It indicates the type of completion
and the places to scan. It is a comma separated list of flags:
. scan the current buffer.
w scan other windows.
b scan other loaded buffers.
u scan the unloaded buffers.
k scan the files given with the 'dictionary' option.
k[dict] scan the file [dict]. Several "k" flags can be given,
patterns are valid too. For example:
:set cpt=k/usr/dict/*,k~/spanish
i scan current and included files.
] tag completion.
t same as "]".
Unloaded buffers are not loaded, thus their autocmds |:autocmd| are
not executed, this may lead to unexpected completions from some files
(gziped files for example)
A nice value is:
:set cpt=.,b,u
As U can see, CTRL-N and CTRL-P can be used to do any 'iskeyword'-
based expansion (eg dictionary |i_CTRL-X_CTRL-K|, include
|i_CTRL-X_CTRL-I|, tag |i_CTRL-X_CTRL-]| and normal expansions)
*'confirm'* *'cf'* *'noconfirm'* *'nocf'*
'confirm' 'cf' boolean (default off)
global
{not in Vi}
When 'confirm' is on, certain operations that would normally
fail because of unsaved changes to a buffer, e.g. ":q" and ":e",
instead raise a |dialog| asking if you wish to save the current
file(s). You can still use a ! to unconditionally abandon a buffer.
If 'confirm' is off you can still activate confirmation for one
command only (this is most useful in mappings) with the |:confirm|
command.
Also see the |confirm()| function and the 'v' flag in 'guioptions'.
*'cpoptions'* *'cpo'*
'cpoptions' 'cpo' string (Vim default: "aABceFs",
Vi default: all flags)
global
{not in Vi}
A sequence of single character flags. 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.
To avoid problems with flags that are added in the future, use the
"+=" and "-=" feature of ":set" |add-option-flags|.
contains behaviour
a When included, a ":read" command with a file name
argument will set the alternate file name for the
current window.
A When included, a ":write" command with a file name
argument will set the alternate file name for the
current window.
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|.
B A backslash has no special meaning in mappings,
abbreviations and the "to" part of the menu commands.
Remove this flag to be able to use a backslash like a
CTRL-V. For example, the command ":map X \<Esc>"
results in X being mapped to:
'B' included: "\^[" (^[ is a real <Esc>)
'B' excluded: "<Esc>" (5 characters)
('<' excluded in both cases)
< Disable the recognition of special key codes in |<>|
form in mappings, abbreviations, and the "to" part of
menu commands. For example, the command
":map X <Tab>" results in X being mapped to:
'<' included: "<Tab>" (5 characters)
'<' excluded: "^I" (^I is a real <Tab>)
Also see the 'k' flag below.
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.
d Using "./" in the 'tags' option doesn't mean to use
the tags file relative to the current file, but the
tags file in the current directory.
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>.
E It is an error when using "y", "d", "c", "g~", "gu" or
"gU" on an Empty region. The operators only work when
at least one character is to be operate on. Example:
This makes "y0" fail in the first column.
f When included, a ":read" command with a file name
argument will set the file name for the current buffer,
if the current buffer doesn't have a file name yet.
F When included, a ":write" command with a file name
argument will set the file name for the current
buffer, if the current buffer doesn't have a file name
yet.
j When joining lines, only add two spaces after a '.',
not after '!' or '?'. Also see 'joinspaces'.
k Disable the recognition of raw key codes in
mappings, abbreviations, and the "to" part of menu
commands. For example, if <Key> sends ^[OA (where ^[
is <Esc>), the command ":map X ^[OA" results in X
being mapped to:
'k' included: "^[OA" (3 characters)
'k' excluded: "<Key>" (one key code)
Also see the '<' flag above.
l Backslash in a [] range in a search pattern is taken
literally, only "\]" is special See |/[]|
'l' included: "/[ \t]" finds <Space>, '\' and 't'
'l' excluded: "/[ \t]" finds <Space> and <Tab>
L When the 'list' option is set, 'wrapmargin' and
'textwidth' count a <Tab> as two characters, instead
of the normal behaviour of a <Tab>.
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. |'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 'fileformat'). 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)
X yes each time when buffer entered (vi comp.)
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.
u Undo is Vi compatible. See |undo-two-ways|.
w When using "cw" on a blank character, only change one
character and not all blanks until the start of the
next word.
W Don't overwrite a readonly file. When omitted, ":w!"
overwrites a readonly file, if possible.
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. |c_<Esc>|
y A yank command can be redone with ".".
$ 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.
! When redoing a filter command, use the last used
external command, whatever it was. Otherwise the last
used -filter- command is used.
* Use ":*" in the same way as ":@". When not included,
":*" is an alias for ":'<,'>", select the Visual area.
% Vi-compatible matching is done for the "%" command.
Does not recognize "#if", "#endif", etc.
Does not recognize "/*" and "*/".
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,
everything 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.
*'cscopeprg'* *'csprg'*
'cscopeprg' 'csprg' string (default "cscope")
global
{not available when compiled without the |+cscope|
feature}
{not in Vi}
Specifies the command to execute cscope. See |cscopeprg|.
*'cscopetag'* *'cst'*
'cscopetag' 'cst' boolean (default off)
global
{not available when compiled without the |+cscope|
feature}
{not in Vi}
Use cscope for tag commands. See |cscope-options|.
*'cscopetagorder'* *'csto'*
'cscopetagorder' 'csto' number (default 0)
global
{not available when compiled without the |+cscope|
feature}
{not in Vi}
Determines the order in which ":cstag" performs a search. See
|cscopetagorder|.
*'cscopeverbose'* *'csverb'*
'cscopeverbose' 'csverb' boolean (default off)
global
{not available when compiled without the |+cscope|
feature}
{not in Vi}
Give messages when adding a cscope database. See |cscopeverbose|.
*'define'* *'def'*
'define' 'def' string (default "^#\s*define")
global
{not in Vi}
Pattern to be used to find a macro definition. It is a search
pattern, just like for the "/" command. This option is used for the
commands like "[i" and "[d" |include-search|. The 'isident' option is
used to recognize the identifier name after the match. See
|option-backslash| about inserting backslashes to include a space or
backslash.
The default value is for C programs. For C++ this value would be
useful, to include const type declarations:
^\(#\s*define\|[a-z]*\s*const\s*[a-z]*\)
When using the ":set" command, you need to double the backslashes!
*'dictionary'* *'dict'*
'dictionary' 'dict' string (default "")
global
{not in Vi}
List of file names, separated by commas, that are used to lookup words
for keyword completion commands |i_CTRL-X_CTRL-K|. Each file should
contain a list of words. This can be one word per line, or several
words per line, separated by non-keyword characters (white space is
preferred).
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 |option-backslash| about using backslashes.
Where to find a list of words?
- On FreeBSD, there is the file "/usr/share/dict/words".
- In the Simtel archive, look in the "msdos/linguist" directory.
- In "miscfiles" of the GNU collection.
The use of |:set+=| and |:set-=| is preferred when adding or removing
directories from the list. This avoids problems when a future version
uses another default.
*'digraph'* *'dg'* *'nodigraph'* *'nodg'*
'digraph' 'dg' boolean (default off)
global
{not in Vi}
{not available when compiled without the |+digraphs|
feature}
Enable the entering of digraphs in Insert mode with {char1} <BS>
{char2}. See |digraphs|.
*'directory'* *'dir'*
'directory' 'dir' string (default for Amiga: ".,t:",
for MS-DOS and Win32: ".,c:\tmp,c:\temp"
for Unix: ".,~/tmp,/var/tmp,/tmp")
global
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. On Unix, a dot is prepended to the file name, so
it doesn't show in a directory listing.
- A directory starting with "./" (or ".\" for MS-DOS et.al.) means to
put the swap file relative to where the edited file is. The leading
"." is replaced with the path name of the edited file.
- 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 |:set_env|.
- Careful with '\' characters, type one before a space, type two to
get one in the option (see |option-backslash|), 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.
"/var/tmp" is often not cleared when rebooting, thus is a better
choice than "/tmp". But it can contain a lot of files, your swap
files get lost in the crowd. That is why a "tmp" directory in your
home directory is tried first.
The use of |:set+=| and |:set-=| is preferred when adding or removing
directories from the list. This avoids problems when a future version
uses another default.
{Vi: directory to put temp file in, defaults to "/tmp"}
*'ed'* *'edcompatible'* *'noed'* *'noedcompatible'*
'edcompatible' 'ed' boolean (default off)
global
Makes the 'g' and 'c' flags of the ":substitute" command to be
toggled each time the flag is given. See |complex-change|. See
also 'gdefault' option.
*'endofline'* *'eol'* *'noendofline'* *'noeol'*
'endofline' 'eol' boolean (default on)
local to buffer
{not in Vi}
When writing a file and this option is off and the 'binary' option
is on, no <EOL> 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 <EOL> 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
<EOL> 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 if you want to.
*'equalalways'* *'ea'* *'noequalalways'* *'noea'*
'equalalways' 'ea' boolean (default on)
global
{not in Vi}
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.
*'equalprg'* *'ep'*
'equalprg' 'ep' string (default "")
global
{not in Vi}
External program to use for "=" command. When this option is empty
the internal formatting functions are used ('lisp' or 'cindent').
Environment variables are expanded |:set_env|. See |option-backslash|
about including spaces and backslashes.
*'errorbells'* *'eb'* *'noerrorbells'* *'noeb'*
'errorbells' 'eb' boolean (default off)
global
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 <Esc> in Normal
mode). See 'visualbell' on how to make the bell behave like a beep,
screen flash or do nothing.
*'errorfile'* *'ef'*
'errorfile' 'ef' string (Amiga default: "AztecC.Err",
others: "errors.err")
global
{not in Vi}
{not available when compiled without the |+quickfix|
feature}
Name of the errorfile for the QuickFix mode (see |:cf|).
When the "-q" command-line argument is used, 'errorfile' is set to the
following argument. See |-q|.
NOT used for the ":make" command. See 'makeef' for that.
Environment variables are expanded |:set_env|.
See |option-backslash| about including spaces and backslashes.
*'errorformat'* *'efm'*
'errorformat' 'efm' string (default is very long)
global
{not in Vi}
{not available when compiled without the |+quickfix|
feature}
Scanf-like description of the format for the lines in the error file
(see |errorformat|).
*'esckeys'* *'ek'* *'noesckeys'* *'noek'*
'esckeys' 'ek' boolean (Vim default: on, Vi default: off)
global
{not in Vi}
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. Instead of resetting this option, you might want to
try changing the values for 'timeoutlen' and 'ttimeoutlen'. Note that
when 'esckeys' is off, you can still map anything, but the cursor keys
won't work by default.
*'eventignore'* *'ei'*
'eventignore' 'ei' string (default "")
global
{not in Vi}
A list of autocommand event names, which are to be ignored.
When set to "all", all autocommand events are ignored, autocommands
will not be executed.
Otherwise this is a comma separated list of event names. Example:
:set ei=WinEnter,WinLeave
*'expandtab'* *'et'* *'noexpandtab'* *'noet'*
'expandtab' 'et' boolean (default off)
local to buffer
{not in Vi}
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| and |ins-expandtab|.
*'exrc'* *'ex'* *'noexrc'* *'noex'*
'exrc' 'ex' boolean (default off)
global
{not in Vi}
Enables the reading of .vimrc, .exrc and .gvimrc in the current
directory. If you switch this option on you should also consider
setting the 'secure' option (see |initialization|). Using a local
.exrc, .vimrc or .gvimrc is a potential security leak, use with care!
also see |.vimrc| and |gui-init|.
'fileencoding' 'fe' string (default: "ansi")
local to buffer
{not in Vi}
Enables editing of alternative encoded files, for example shift-JIS or
Unicode. When you set this option, it fires of a 'FileEncoding'
autocommand so you can set up fonts if necessary.
Possible values are:
ansi default setting, good for most Western languages
unicode <to be implemented>
japan set to use shift-JIS (Windows CP 932) encoding
korea set to use Korean DBCS
prc use simplified Chinese encoding
taiwan use traditional Chinese encoding
hebrew <to be implemented>
farsi <to be implemented>
This lets you view, for example, a Japanese S-JIS encoded file
(provided you have a suitable font). The DBCS characters are treated
as a unit, i.e. you cursor past them or delete them, etc as a unit,
rather than deleting half a character.
*'fileformat'* *'ff'*
'fileformat' 'ff' string (DOS, Win32, OS/2 default: "dos",
Unix default: "unix",
Macintosh default: "mac")
local to buffer
{not in Vi}
This gives the <EOL> of the current buffer, which is used for
reading/writing the buffer from/to a file:
dos <CR> <NL>
unix <NL>
mac <CR>
When "dos" is used, CTRL-Z at the end of a file is ignored.
See |file-formats| and |file-read|.
When 'binary' is set, the value of 'fileformat' is ignored, file I/O
works like it was set to "unix'.
This option is set automatically when starting to edit a file and
'fileformats' is not empty and 'binary' is off.
When this option is set, after starting to edit a file, the 'modified'
option is set, because the file would be different when written.
For backwards compatibility: When this option is set to "dos",
'textmode' is set, otherwise 'textmode' is reset.
*'fileformats'* *'ffs'*
'fileformats' 'ffs' string (Vim+Vi DOS, Win32, OS/2 default: "dos,unix",
Vim Unix default: "unix,dos",
Vim Mac default: "mac,unix,dos",
Vi others default: "")
global
{not in Vi}
This gives the end-of-line (<EOL>) formats that will be tried. It is
used when starting to edit a new buffer and when reading a file into
an existing buffer:
- When empty, the format defined with 'fileformat' will be used
always. It is not set automatically.
- When set to one name, that format will be used whenever a new buffer
is opened. 'fileformat' is set accordingly for that buffer. The
'fileformats' name will be used when a file is read into an existing
buffer, no matter what 'fileformat' for that buffer is set to.
- When more than one name is present, separated by commas, automatic
<EOL> detection will be done when reading a file. When starting to
edit a file, a check is done for the <EOL>:
1. If all lines end in <CR><NL>, and 'fileformats' includes "dos",
'fileformat' is set to "dos".
2. If a <NL> is found and 'fileformats' includes "unix, 'fileformat'
is set to "unix". Note that when a <NL> is found without a
preceding <CR>, "unix" is prefered over "dos".
3. If 'fileformats' includes "mac", 'fileformat' is set to "mac".
This means that "mac" is only choosen when "unix" is not present,
or when no <NL> is found in the file, and when "dos" is not
present, or no <CR><NL> is present in the file.
4. If 'fileformat' is still not set, the first name from
'fileformats' is used.
When reading a file into an existing buffer, the same is done, but
this happens like 'fileformat' has been set appropriately for that
file only, the option is not changed.
When 'binary' is set, the value of 'fileformats' is not used.
For systems with a Dos-like <EOL> (<CR><NL>), when reading files that
are ":source"ed and for vimrc files, automatic <EOL> detection may be
done:
- When 'fileformats' is empty, there is no automatic detection. Dos
format will be used.
- When 'fileformats' is set to one or more names, automatic detection
is done. This is based on the first <NL> in the file: If there is a
<CR> in front of it, Dos format is used, otherwise Unix format is
used.
Also see |file-formats|.
For backwards compatibility: When this option is set to an empty
string or one format (no comma is included), 'textauto' is reset,
otherwise 'textauto' is set.
*'filetype'* *'ft'*
'filetype' 'ft' string (RISC OS default: "Text",
others default: "")
local to buffer
{not in Vi}
{only available when compiled with the |+filetype|
feature}
Some systems store extra information about files besides name,
datastamp and permissions. This option contains the extra information,
the nature of which will vary between systems.
The value of this option is usually set when the file is loaded, and
may also change the way the file is written.
It can affect the pattern matching of the automatic commands.
|autocmd-filetypes|
*'fkmap'* *'fk'* *'nofkmap'* *'nofk'*
'fkmap' 'fk' boolean (default off)
global
{not in Vi}
{only available when compiled with the |+rightleft|
feature}
When on, the keyboard is mapped for the Farsi character set.
Normally you would set 'allowrevins' and use CTRL-_ in insert mode to
toggle this option |i_CTRL-_|. See |farsi.txt|.
*'formatoptions'* *'fo'*
'formatoptions' 'fo' string (Vim default: "tcq", Vi default: "vt")
local to buffer
{not in Vi}
This is a sequence of letters which describes how automatic
formatting is to be done. See |fo-table|. When the 'paste' option is
on, no formatting is done (like 'formatoptions' is empty). Commas can
be inserted for readability.
To avoid problems with flags that are added in the future, use the
"+=" and "-=" feature of ":set" |add-option-flags|.
*'formatprg'* *'fp'*
'formatprg' 'fp' string (default "")
global
{not in Vi}
The name of an external program that will be used to format the lines
selected with the "gq" 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 |:set_env|. See |option-backslash| about including spaces
and backslashes.
*'gdefault'* *'gd'* *'nogdefault'* *'nogd'*
'gdefault' 'gd' boolean (default off)
global
{not in Vi}
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 |complex-change|.
command 'gdefault' on 'gdefault' off
:s/// subst. all subst. one
:s///g subst. one subst. all
:s///gg subst. all subst. one
*'grepformat'* *'gfm'*
'grepformat' 'gfm' string (default "%f:%l%m,%f %l%m")
global
{not in Vi}
Format to recognize for the ":grep" command output.
This is a scanf-like string that uses the same format as the
'errorformat' option: see |errorformat|.
*'grepprg'* *'gp'*
'grepprg' 'gp' string (default "grep -n", Win32: "findstr /n")
global
{not in Vi}
Program to use for the ":grep" command. This option may contain '%'
and '#' characters, which are expanded like when used in a
command-line. Environment variables are expanded |:set_env|. See
|option-backslash| about including spaces and backslashes.
See also the section |:make_makeprg|, since most of the comments there
apply equally to 'grepprg'.
*'guicursor'* *'gcr'*
'guicursor' 'gcr' string (default "n-v-c:block-Cursor,ve:ver35-Cursor,
o:hor50-Cursor,i-ci:ver25-Cursor,
r-cr:hor20-Cursor,sm:block-Cursor
-blinkwait175-blinkoff150-blinkon175")
global
{not in Vi}
{only available when compiled with GUI enabled, and
for MSDOS and Win32 console}
This option tells Vim what the cursor should look like in different
modes. The option is a comma separated list of parts. Each part
consist of a mode-list and an argument-list:
mode-list:argument-list,mode-list:argument-list,..
The mode-list is a dash separated list of these modes:
n Normal mode
v Visual mode
ve Visual mode with 'selection' "exclusive" (same as 'v',
if not specified)
o Operator-pending mode
i Insert mode
r Replace mode
c Command-line Normal (append) mode
ci Command-line Insert mode
cr Command-line Replace mode
sm showmatch in Insert mode
a all modes
The argument-list is a dash separated list of these arguments:
hor{N} horizontal bar, {N} percent of the character height
ver{N} vertical bar, {N} percent of the character width
block block cursor, fills the whole character
[only one of the above three should be present]
blinkwait{N} *cursor-blinking*
blinkon{N}
blinkoff{N}
blink times for cursor: blinkwait is the delay before
the cursor starts blinking, blinkon is the time that
the cursor is shown and blinkoff is the time that the
cursor is not shown. The times are in msec. When one
of the numbers is zero, there is no blinking. The
default is: "blinkwait700-blinkon400-blinkoff250".
These numbers are used for a missing entry. This
means that blinking is enabled by default. To switch
blinking off you can use "blinkon0". The cursor only
blinks when Vim is waiting for input, not while
executing a command.
To make the cursor blink in an xterm, see
tools/blink.c.
{group-name}
a highlight group name, that sets the color and font
for the cursor
Examples of parts:
n-c-v:block-nCursor in Normal, Command-line and Visual mode, use a
block cursor with colors from the "nCursor"
highlight group
i-ci:ver30-iCursor-blinkwait300-blinkon200-blinkoff150
In Insert and Command-line Insert mode, use a
30% vertical bar cursor with colors from the
"iCursor" highlight group. Blink a bit
faster.
The 'a' mode is different. It will set the given argument-list for
all modes. It does not reset anything to defaults. This can be used
to do a common setting for all modes. For example, to switch off
blinking: "a:blinkon0"
Examples of cursor highlighting:
:highlight Cursor gui=reverse guifg=NONE guibg=NONE
:highlight Cursor gui=NONE guifg=bg guibg=fg
In an MSDOS or Win32 console, only the height of the cursor can be
changed. This can be done by specifying a block cursor, or a
percentage for a vertical or horizontal cursor.
*'guifont'* *'gfn'*
'guifont' 'gfn' string (default "")
global
{not in Vi}
{only available when compiled with GUI enabled}
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.
Win32 only:
:set guifont=*
will bring up a font requester, where you can pick the font you want.
If none of the fonts can be loaded, vim will keep the current setting.
If an empty font list is given, 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.
For the Win32 GUI
- takes these options in the font name:
hXX - height is XX (points)
wXX - width is XX (points)
b - bold
i - italic
u - underline
s - strikeout
Use a ':' to separate the options.
- A '_' can be used in the place of a space, so you don't need to use
backslashes to escape the spaces.
- Example:
:set guifont=courier_new:h12:w5:b
See also |font-sizes|.
*'guioptions'* *'go'*
'guioptions' 'go' string (default "agimrt" (Unix) or "gmrt")
global
{not in Vi}
{only available when compiled with GUI enabled}
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.
To avoid problems with flags that are added in the future, use the
"+=" and "-=" feature of ":set" |add-option-flags|.
Valid letters are as follows:
'a' Autoselect: 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 <"*> 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 a yank or delete operation.
'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|
'i' Use a Vim icon. It's black&white, because of limitations of
X11. For a color icon, see |X11-icon|.
'm' Menu bar is present when 'm' is included.
'g' Grey menu items: Make menu items that are not active grey. If
'g' is not included inactive menu items are not shown at all.
't' Include tearoff menu items. Currently only works for Win32
and Motif 1.2 GUI.
'T' Include Toolbar. Currently only in Win32 GUI.
'r' Right-hand scrollbar is present when 'r' is included.
'l' Left-hand scrollbar is present when 'l' is included.
'b' Bottom (horizontal) scrollbar is present when 'b' is included.
And yes, you may even have scrollbars on the left AND the right if
you really want to :-). See |gui-scrollbars| for more information.
'v' Use a vertical button layout for dialogs. When not included,
a horizontal layout is preferred, but when it doesn't fit a
vertical layout is used anyway.
'p' Use Pointer callbacks for X11 GUI. This is required for some
window managers. If the cursor is not blinking or hollow at
the right moment, try adding this flag. This must be done
before starting the GUI. Set it in your gvimrc. Adding or
removing it after the GUI has started has no effect.
*'guipty'* *'noguipty'*
'guipty' boolean (default on)
global
{not in Vi}
{only available when compiled with GUI enabled}
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|.
*'helpfile'* *'hf'*
'helpfile' 'hf' string (default (Amiga) "vim:doc/help.txt"
(MSDOS) "$VIM\doc\help.txt"
(others) "$VIM/doc/help.txt")
global
{not in Vi}
Name of the help file. All help files should be placed together in
one directory. Environment variables are expanded |:set_env|. For
example: "$VIM/doc/help.txt". If $VIM is not set, $HOME is also
tried. Also see |$VIM|. |option-backslash| about including spaces
and backslashes.
*'helpheight'* *'hh'*
'helpheight' 'hh' number (default 20)
global
{not in Vi}
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.
*'hidden'* *'hid'* *'nohidden'* *'nohid'*
'hidden' 'hid' boolean (default off)
global
{not in Vi}
When off a buffer is unloaded when it is abandoned. When on a buffer
becomes hidden when it is abandoned. If the buffer is still displayed
in another window, it does not become hidden, of course.
The commands that move through the buffer list sometimes make a buffer
hidden although the 'hidden' option is off: When the buffer is
modified, 'autowrite' is off or writing is not possible, and the '!'
flag was used. See also |windows.txt|.
WARNING: It's easy to forget that you have changes in hidden buffers.
Think twice when using ":q!" or ":qa!".
*'highlight'* *'hl'*
'highlight' 'hl' string (default (as a single string):
"8:SpecialKey,@:NonText,d:Directory,
e:ErrorMsg,i:IncSearch,l:Search,m:MoreMsg,
M:ModeMsg,n:LineNr,r:Question,
s:StatusLine,S:StatusLineNC,t:Title,
v:Visual,w:WarningMsg")
global
{not in Vi}
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:
|hl-SpecialKey| 8 Meta and special keys listed with ":map"
|hl-NonText| @ '~' and '@' at the end of the window and
characters from 'showbreak'
|hl-Directory| d directories in CTRL-D listing and other special
things in listings
|hl-ErrorMsg| e error messages
h (obsolete, ignored)
|hl-IncSearch| i 'incsearch' highlighting
|hl-Search| l last search pattern highlighting (see 'hlsearch')
|hl-MoreMsg| m |more-prompt|
|hl-ModeMsg| M Mode (e.g., "-- INSERT --")
|hl-LineNr| n line number for ":number" and ":#" commands
|hl-Question| r |hit-return| prompt and yes/no questions
|hl-StatusLine| s status line of current window |status-line|
|hl-StatusLineNC| S status lines of not-current windows
|hl-Title| t Titles for output from ":set all", ":autocmd" etc.
|hl-Visual| v Visual mode
|hl-WarningMsg| 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
- no highlighting
: use a highlight group
The default is used for occasions that are not included.
If you want to change what the display modes do, see |dos-colors|
for an example.
When using the ':' display mode, this must be followed by the name of
a highlight group. A highlight group can be used to define any type
of highlighting, including using color. See |:highlight| on how to
define one. The default uses a different group for each occasion.
See |highlight-default| for the default highlight groups.
*'hlsearch'* *'hls'* *'nohlsearch'* *'nohls'*
'hlsearch' 'hls' boolean (default off)
global
{not in Vi}
{not available when compiled without the
|+extra_search| feature}
When there is a previous search pattern, highlight all its matches.
The type of highlighting used can be set with the 'l' occasion in the
'highlight' option. This uses the "Search" highlight group by
default. Note that only the matching text is highlighted, any offsets
are not applied.
See also: 'incsearch'.
When you get bored looking at the highlighted matches, you can turn it
off with |:nohlsearch|. As soon as you use a search command, the
highlighting comes back.
*'history'* *'hi'*
'history' 'hi' number (Vim default: 20, Vi default: 0)
global
{not in Vi}
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 |cmdline-editing|).
*'hkmap'* *'hk'* *'nohkmap'* *'nohk'*
'hkmap' 'hk' boolean (default off)
global
{not in Vi}
{only available when compiled with the |+rightleft|
feature}
When on, the keyboard is mapped for the Hebrew character set.
Normally you would set 'allowrevins' and use CTRL-_ in insert mode to
toggle this option. See |rightleft.txt|.
*'hkmapp'* *'hkp'* *'nohkmapp'* *'nohkp'*
'hkmapp' 'hkp' boolean (default off)
global
{not in Vi}
{only available when compiled with the |+rightleft|
feature}
When on, phonetic keyboard mapping is used. 'hkmap' must also be on.
This is useful if you have a non-Hebrew keyboard.
See |rightleft.txt|.
*'icon'* *'noicon'*
'icon' boolean (default off, on when title can be restored)
global
{not in Vi}
When on, the icon text of the window will be set to the name of the
file currently being edited. Only the last part of the name is used.
Overridden by the 'iconstring' option.
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 |X11|.
See |X11-icon| for changing the icon on X11.
*'iconstring'*
'iconstring' string (default "")
global
{not in Vi}
When this options is not empty, it will be used for the icon of the
window. This happens regardless of the 'icon' option.
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 |X11|.
Does not work for MS Windows.
*'ignorecase'* *'ic'* *'noignorecase'* *'noic'*
'ignorecase' 'ic' boolean (default off)
global
Ignore case in search patterns. Also used when searching in the tags
file.
*'include'* *'inc'*
'include' 'inc' string (default "^#\s*include")
global
{not in Vi}
Pattern to be used to find an include command. It is a search
pattern, just like for the "/" command (See |pattern|). The default
value is for C programs. This option is used for the commands "[i",
"]I", "[d", etc.. The 'isfname' option is used to recognize the file
name that comes after the matched pattern. See |option-backslash|
about including spaces and backslashes.
*'incsearch'* *'is'* *'noincsearch'* *'nois'*
'incsearch' 'is' boolean (default off)
global
{not in Vi}
{not available when compiled without the
|+extra_search| feature}
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. Note that
the match will be shown, but the cursor is not actually positioned
there. You still need to finish the search command with <CR> to move
the cursor. The highlighting can be set with the 'i' flag in
'highlight'. See also: 'hlsearch'.
*'infercase'* *'inf'* *'noinfercase'* *'noinf'*
'infercase' 'inf' boolean (default off)
local to buffer
{not in Vi}
When doing keyword completion in insert mode |ins-completion|, 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.
*'insertmode'* *'im'* *'noinsertmode'* *'noim'*
'insertmode' 'im' boolean (default off)
global
{not in Vi}
Makes Vim work in a way that Insert mode is the default mode. Useful
if you want to use Vim as a modeless editor.
These Insert mode commands will be useful:
- Use the cursor keys to move around.
- Use CTRL-O to execute one Normal mode command |i_CTRL-O|). When
this is a mapping, it is executed as if 'insertmode' was off.
Normal mode remains active until the mapping is finished.
*i_CTRL-L*
- Use CTRL-L to execute a number of Normal mode commands, then use
<Esc> to get back to Insert mode.
These items change when 'insertmode' is set:
- when starting to edit of a file, Vim goes to Insert mode.
- <Esc> in Insert mode is a no-op and beeps.
- <Esc> in Normal mode makes Vim go to Insert mode.
- CTRL-L in Insert mode is a command, it is not inserted.
- CTRL-Z in Insert mode suspends Vim, see |CTRL-Z|. *i_CTRL-Z*
However, when <Esc> is used inside a mapping, it behaves like
'insertmode' was not set. This was done to be able to use the same
mappings with 'insertmode' set or not set.
*'isfname'* *'isf'*
'isfname' 'isf' string (default for MS-DOS, Win32 and OS/2:
"@,48-57,/,.,-,_,+,,,$,:,\"
for AMIGA: "@,48-57,/,.,-,_,+,,,$,:"
otherwise: "@,48-57,/,.,-,_,+,,,$,:,~")
global
{not in Vi}
The characters given by this option are included in file names and
path names. Filenames 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").
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 |option-backslash| about including spaces and backslashes.
*'isident'* *'isi'*
'isident' 'isi' string (default for MS-DOS, Win32 and OS/2:
"@,48-57,_,128-167,224-235"
otherwise: "@,48-57,_,192-255")
global
{not in Vi}
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.
Careful: If you change this option, it might break expanding
environment variables. E.g., when '/' is included and Vim tries to
expand "$HOME/.viminfo". Maybe you should change 'iskeyword' instead.
*'iskeyword'* *'isk'*
'iskeyword' 'isk' string (Vim default for MS-DOS and Win32:
"@,48-57,_,128-167,224-235"
otherwise: "@,48-57,_,192-255"
Vi default: "@,48-57,_")
local to buffer
{not in Vi}
Keywords are used in searching and recognizing with many commands:
"w", "*", "[i", etc. See 'isfname' for a description of the format 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.
*'isprint'* *'isp'*
'isprint' 'isp' string (default for MS-DOS and Win32: "@,~-255"
otherwise: "@,161-255")
global
{not in Vi}
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 "~?"
*'joinspaces'* *'js'* *'nojoinspaces'* *'nojs'*
'joinspaces' 'js' boolean (default on)
global
{not in Vi}
Insert two spaces after a '.', '?' and '!' with a join command.
When 'cpoptions' includes the 'j' flag, only do this after a '.'.
Otherwise only one space is inserted.
*'keymodel'* *'km'*
'keymodel' 'km' string (default "")
List of comma separated words, which enable special things that keys
can do. These values can be used:
startsel Using a shifted special key starts selection (either
Select mode or Visual mode, depending on "key" being
present in 'selectmode').
stopsel Using a not-shifted special key stops selection.
Special keys in this context are the cursor keys, <End>, <Home>,
<PageUp> and <PageDown>.
The 'keymodel' option is set by the |:behave| command.
*'keywordprg'* *'kp'*
'keywordprg' 'kp' string (default "man" or "man -s",
OS/2: "view /", VMS: "help")
global
{not in Vi}
Program to use for the |K| command. Environment variables are
expanded |:set_env|. When empty ":help" is used.
When "man" is used, Vim will automatically translate a count for the
"K" command to a section number. Also for "man -s", in which case the
"-s" is removed when there is no count.
See |option-backslash| about including spaces and backslashes.
Example:
:set keywordprg=man\ -s
*'langmap'* *'lmap'*