I have a $HOME\_vimrc present, but it doesn't show up in the output of :scriptnames. And when I run gvim -V, it reports:

could not source "$HOME\_vimrc"

The only thing in my $HOME\_vimrc is the following line:

set packpath+=C:\Users\username\vimfiles

In case there was something wrong with that path, I also changed the entire contents of the $HOME\_vimrc file to this, with the same result:

set number

When I run :echo $HOME from gvim, it reports my Windows user profile directory C:\Users\username. I have a $HOME\_gvimrc which it reads fine. My vimfiles directory is at the default $HOME\vimfiles which it seems to read fine, because it's sourcing a color scheme from there.

Running :version shows the following entries:

   system vimrc file: "$VIM\vimrc"
     user vimrc file: "$HOME\_vimrc"
 2nd user vimrc file: "$HOME\vimfiles\vimrc"
 3rd user vimrc file: "$VIM\_vimrc"
    user gvimrc file: "$HOME\_gvimrc"

Running :echo $MYVIMRC outputs C:\Program Files (x86)\Vim\_vimrc.

I've tried running as both administrator and my Windows username.

Is there something I'm missing?


The output of icacls _vimrc:

C:\Users\username> icacls _vimrc

That last entry, DOMAIN\username, is the login I'm using to run gVim.

  • 1
    What's the output of "icacls _vimrc"? This will display your permissions for the file.
    – Rob Mosher
    Commented Oct 28, 2019 at 15:52
  • 1
    Welcome to Vi and Vim! Rob's suggestion is a good place to start (this could be a permissions error). Please edit your question as you provide new details
    – D. Ben Knoble
    Commented Oct 28, 2019 at 15:53
  • I've updated the question to include the output. Let me know if you need more details.
    – William L.
    Commented Oct 28, 2019 at 17:04
  • @RobMosher I can't read windows stuff there, so idk if that's right
    – D. Ben Knoble
    Commented Oct 29, 2019 at 0:55
  • The (F)s indicate ful read/write access for each of those users. But it looks like William found the answer.
    – Rob Mosher
    Commented Oct 30, 2019 at 12:10

2 Answers 2


The solution was to define $HOME as a Windows environment variable.

Once I did that and restarted gVim, it read my ~\_vimrc and also sourced my native Vim 8.1 packages correctly.

Source: this answer at Stack Overflow.

  • 1
    Fallback to $HOMEDRIVE$HOMEPATH or $USERPROFILE should usually take care of that... Do you not have those defined in your environment for some reason?
    – filbranden
    Commented Oct 29, 2019 at 15:09
  • 1
    Ah, $HOMEDRIVE$HOMEPATH is set to M:\ , which is a mapped network drive. $USERPROFILE is set to C:\Users\username. If it was using$HOMEDRIVE$HOMEPATH, it would explain why it couldn't find my _vimrc, but then why does :echo $HOME show C:\users\username?
    – William L.
    Commented Oct 29, 2019 at 16:36
  • You might want to update your answer to reflect that. Yeah it's odd that :echo $HOME is showing the other path... Not sure why that would happen...
    – filbranden
    Commented Oct 29, 2019 at 16:48
  • It may be that vim is setting $HOME itself somehow, or that it is coming from somewhere else. I would open up a windows terminal, and get the environment value HOME (I think the syntax on cmd is %HOME% or something)
    – D. Ben Knoble
    Commented Oct 29, 2019 at 16:52
  • %HOME% was not set in Windows. Once I set it in Windows, gVim started reading my ~\_vimrc.
    – William L.
    Commented Oct 31, 2019 at 14:53

My problem was I was trying to source my vimrc file within gvim/vim and my changes were not being applied in the session. I would have to reopen gvim/vim to see the changes. Adding the $HOME user environment variable: C:\Users\<username> resolved this.

For my setup I am using Windows 10 and vim/gvim 8.2.

Instead of using the user vimrc file: $HOME\_vimrc and user gvimrc file: $HOME\_gvimrc I used 2nd user vimrc file: $HOME\vimfiles\vimrc and 2nd user gvimrc file: $HOME\vimfiles\gvimrc

These were the values prior to the addition of the windows user environment variable and did not change afterwards.

:echo $VIM = C:\Program Files (x86)\Vim
:echo $HOME = C:\Users\<username>
:echo $HOMEDRIVE = C:
:echo $HOMEPATH = \Users\<username>
:echo $MYVIMRC = C:\Users\<username>\vimfiles\vimrc
:echo $MYGVIMRC = C:\Users\<username>\vimfiles\gvimrc

Note: I did not have enough reputation to comment, but I still wanted to add this in case anyone else decides to use the 2nd user vimrc/gvimrc files instead.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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