Search notes:

vimrc

$MYVIMRC is set to the first vimrc file that is found when searching for the vimrc file (Compare vim script: $ MYVIMRC).
In order to execute an EX command before vimrc (or any other startup file) is sourced, the --cmd command line option can be used.

Default vimrc file

TODO: found in source_startup_scripts():
/*
 * Try to read initialization commands from the following places:
 * - environment variable VIMINIT
 * - user vimrc file (s:.vimrc for Amiga, ~/.vimrc otherwise)
 * - second user vimrc file ($VIM/.vimrc for Dos)
 * - environment variable EXINIT
 * - user exrc file (s:.exrc for Amiga, ~/.exrc otherwise)
 * - second user exrc file ($VIM/.exrc for Dos)
 * The first that exists is used, the rest is ignored.
 */
The initiailization file (as also other command files) are read by do_source(). A speciality of this function is that it tries to read _vimrc if it was unable to read .vimrc (and vice versa - and similar for .exrc/_exrc).
If no vimrc file is found (and vim is not started with -u NONE or -C), then vim loads VIMRUNTIME/defaults.vim.

TODO

The SYS_VIMRC_FILE macro. For Win 32 environments, it seems to be set in os_dos.h.

See also

/etc/vim/vimrc
vim
The -u command line option
$VIMRUNTIME/macmap.vim: The System gvimrc file for Mac OS X
The function source_startup_scripts() in src/main.

Index