Mac – Second user vimrc file usage on vim running on Mac os X 10.8.5 (Mountain Lion)

macbook promacvimosx-mountain-lionvim

I am using MacVim:

:version
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

Best Answer

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.

Related Question