1

My $VIM\_vimrc is as follows:

source $VIMRUNTIME/vimrc_example.vim
source $VIMRUNTIME/mswin.vim
behave mswin

My $HOME\_vimrc does not have this option. I was led to believe that Vim first invokes the system _vimrc in $VIM, then moves on to the user _vimrc in their respective $HOMEs, but it's obvious here that that's no longer the case here. This is important because I need to move all of my personal configs somewhere else, and $VIM is not a good option. Any help would be appreciated.

Edit 1

After the use of :scriptnames as per recommendations of the comment below, I found that indeed, a) $VIM\_vimrc was not used, and b) the first file used was $HOME\_vimrc. I need Vim to use, first and foremost, $VIM\_vimrc, so that Vim recognizes $HOME to be elsewhere of the C:\Users\foo that I currently use.

  • I'm not sure what you are asking for. To see the files that are sourced by Vim, enter the command :scriptnames. – Ralf Feb 8 at 17:15
  • I've just added the observations after :scriptnames in the original question. – Paul Kim Feb 8 at 18:20
  • I found out that Vim only uses $HOME/_vimrc if it exists and overlooks $VIM/_vimrc. Guess I'll need to move my $HOME/_vimrc somewhere else and make that directory $HOME. – Paul Kim Feb 8 at 18:43
  • I still don't get what you want to do and why you want to do it. – Ralf Feb 8 at 18:49
  • I wanted to change my $HOME directory. It was for a personal project. – Paul Kim Feb 8 at 18:53
1

See :help vimrc for a detailed understanding of how _vimrcs work:

When Vim loads, it invokes _vimrcs in the following steps:

  1. $VIM/vimrc
  2. The first existing file of
    1. $HOME/_vimrc
    2. $HOME/vimfiles/_vimrc
    3. $VIM/_vimrc

$VIM/vimrc is the system-wide config file. $VIM/_vimrc is a user-defined config file used if the two $HOME files above are not defined.

  • The name of the system wide vimrc is $VIM/vimrc. Note the missing underscore – Jürgen Krämer Aug 13 at 13:13
  • Right, my mistake. Thanks. – Paul Kim Aug 13 at 13:24
  • No, it's still not correct, $VIM/vimrc is always read. Then the first one of $HOME/_vimrc, $HOME/vimfiles/vimrc, or $VIM/_vimrc (this time with a leading underscore) is read. Vim also accepts a leading dot instead of an underscore. Note that you can have both $VIM/vimrc and $VIM/_vimrc, the first one as a system wide initialization file and the second one as a user initialization file which is ignored if $HOME/_vimrc exists. When you look at :help vimrc, steps a. to d. define the order of initialization. The part about the vimrc files before step a. is just informative. – Jürgen Krämer Aug 13 at 13:41
  • Oh, I probably didn't have $VIM/vimrc in the first place, that's why it wasn't on :scriptnames. Thanks! – Paul Kim Aug 13 at 13:43

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.