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. – K. Paul 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. – K. Paul 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. – K. Paul Feb 8 at 18:53

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

When Vim loads, it invokes _vimrcs in the following steps: 1. $HOME/_vimrc 2. $HOME/vimfiles/_vimrc 3. $VIM/_vimrc

So whatever you do with your $VIM/_vimrc doesn't actually matter as long as you have a _vimrc in $HOME or subsequent directories, which was my case. Since my $HOME no longer has both _vimrc and vimfiles/, my system file $VIM/_vimrc is invoked, which allows me to tamper with things that can be applied to all users on the same system.

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.