4

:help startup states, under 3. Execute Ex commands, from environment variables and/or files that (for Unix systems) $HOME/.vimrc or $HOME/.vim/vimrc is read and that The files are searched in the order specified above and only the first one that is found is read.

I do have a (read/writeable) ~/.vim/vimrc file, so I have expected this file to be read first.

However, when I start gvim (debugged with the -V20 flag) I see that gvim first reads /usr/share/vim/vimrc. When it is finished reading this file, it then reads my ~/.vim/vimrc file. I don't want the /usr/share/vim/vimrc file to be read at all.

The environment variable $VIM is not set.

Interestingly (and somewhat surprisingly for me): after gvim is started up fully, :echo $MYVIMRC prints /home/rene/.vim/vimrc.

So, my questions are: why does it behave differently from what is stated in the help file and how do I make sure that only ~/.vim/vimrc is read.

9

Reading system-level configuration before user-level configuration is totally normal and expected in UNIX land.

Anyway, this sentence:

The files are searched in the order specified above and only the first one
that is found is read.

only applies to "personal initializations".

As explained a few paragraphs below, the system vimrc is read no matter what:

b. For Unix, MS-DOS, MS-Windows, OS/2, VMS, Macintosh, RISC-OS and Amiga
   the system vimrc file is read for initializations.  The path of this
   file is shown with the ":version" command.  Mostly it's "$VIM/vimrc".
   Note that this file is ALWAYS read in 'compatible' mode, since the
   automatic resetting of 'compatible' is only done later.  Add a ":set
   nocp" command if you like.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.