I am using MacVim:

VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Aug 10 2013 17:49:20)
MacOS X (unix) version

I've executed :version in vim (to check what patches I had installed) and noticed the following two lines part of the output:

 user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"

What is the 2nd user for, and how would you use it?

I've found and read this question:https://apple.stackexchange.com/q/34996/10733,

but the answer shows how to integrate the ~/.vim/vimrc into .vimrc.

I also did the following search in google which did not yield anything interesting: 2nd user in vim and ~/.vim/vimrc, and how to use ~/.vim/vimrc

  • Would you mind if we migrate this to SuperUser? You might get better answers there.
    – nohillside
    Oct 17, 2013 at 18:06
  • Of course no, problems. I should have put it there myself. I was going to add a bounty on it when the time allowed.
    – Deesbek
    Oct 17, 2013 at 18:07
  • 1
    This is something new in vim 7.4 where they have a different (additional) default vimrc location. What version of vim are you using (as the default one on mac should not have that output)
    – FDinoff
    Oct 17, 2013 at 20:02

2 Answers 2


The "2nd user vimrc file" is a recent addition to Vim, appearing maybe in very late versions of Vim 7.3 but certainly by Vim 7.4.

Some users requested that second location for their personal vimrc file so that they could keep all their Vim configuration files in one directory: ~/.vim on Unix or ~/vimfiles on Windows.

As it says in :help vimrc,

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

So, if you have both ~/.vimrc and ~/.vim/vimrc files, only ~/.vimrc will be used. Most users use either one or the other, but not both.

  • I am in the process of downloading and reading the code. But from what you wrote above @Vucars answer is not correct?
    – Deesbek
    Oct 17, 2013 at 22:48
  • Yes, Vucar's answer is not correct regarding both ~/.vimrc and ~/.vim/vimrc being read if both are present. Vucar may be confused between those files and the system vimrc.
    – garyjohn
    Oct 17, 2013 at 23:22
  • @Deesbek: You're right, I didn't read the code carefully enough. It does indeed pick the first of all those files it finds. I'll edit my answer as soon as I've got some time to do so. Oct 18, 2013 at 15:10

I've taken a look through the code which deals with the output of :version and the various places from whence the .vimrc-file is taken.

Depending on which operating system is used, initialisation files (such as .vimrc) are sought in a number of places. For some operating systems (such as Amiga and most likely Mac as well), more than one directory is examined; there may be up to four different places, which in turn would give you:

  • user vimrc file;
  • 2nd user vimrc file;
  • 3rd user vimrc file and
  • 4th user vimrc file.

(For those interested, the interesting part is in version.c around line 1184.)

As far as I understand from the rest of the code, each of those files is sourced in the order above, stopping as soon as one of those paths does not exist (cf. main.c around line 2993).

So in your particular case, vim would first try to read $HOME/.vimrc. If it exists, it is sourced, and vim looks for ~/.vim/vimrc. If it exists, it is read as well.

You can verify this by putting some commands in either file which produce some output, for example echo "something" into either of the vimrc files.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .