This section describes vim
initialization steps, including those taken for the GUI
versions of vim
performs the following initialization steps:
environment variables, respectively. On MS-DOS and Win32, use
is not set.
was supplied, execute the given file, and
skip the rest of the startup file based initializations.
option has the same effect for ex
mode; only the
option will be interpreted.
Execute the system-wide vimrc
The exact path is set when
is compiled. A typical value is
Execute instructions in the first place that exists of the following four:
The environment variable
The user vimrc
UNIX (or Linux). The location will be different on non-UNIX systems.
does not exist, vim
looks for _vimrc
. On the non-UNIX systems,
the order is reversed.
The environment variable
The user exrc
On non-UNIX systems, _exrc
However, in this case, vim
only looks for
one or the other, not both.
option has been set, then
looks in the current directory
for the first file that exists of the following four.
The others are ignored.
On MS-DOS and Win32 systems, the _xxxrc
files are looked for before the .xxxrc
If they have not yet been set,
options are initialized based on the value of the
option is discussed
in Section 11.9.1
was given on the command line,
is set to zero.
(This option controls how often the swap file is updated.
The more often, the more the swap file is synchronized with all
your changes, but possibly with decreased performance.
Zero means never.)
was supplied, set the appropriate options
for editing binary files.
Perform GUI initializations. See the next subsection.
is set, read the file indicated there.
was supplied, read the named quick fix file.
The quick fix facility is described in
Open and fill all windows, as per the
was supplied, go to the first error.
Jump to the tag given by the
option, if supplied.
Execute any commands given with
That's a lot of steps. As in other areas,
facilities also provide extra flexibility and customizability.
As for nvi
, you can place
common initialization actions into your .exrc
file (i.e., options and commands for UNIX vi
and/or the other clones),
and have your .vimrc
before or after the
file is much like the
file. It can be used to save a large part of the state of your
editing session in between logins.
file stores the following items:
The command-line history
The search string history
Contents of registers
File marks, pointing to locations in files
Last search/substitute pattern (for
reads this file at startup, and when exiting,
merges its current state with the contents of the file and then
If running the GUI version of vim
will fork a new process in order to run
in the background, so that you can continue to give commands to the
parent shell. The
option disables this behavior.
was supplied, vim
executes the given file and
skips the rest of the GUI startup file based initializations.
and then the user gvimrc
These files can be used to configure the GUI. In particular,
you can set up your own menus at this point.