简体   繁体   中英

Vim/gVim 8.1 on Windows 10 won't source $HOME\_vimrc

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.

Someone suggested that I run icacls _vimrc to see the file permissions. Here's the output:

C:\Users\username> icacls _vimrc
_vimrc NT AUTHORITY\SYSTEM:(I)(F)
       BUILTIN\Administrators:(I)(F)
       DOMAIN\username:(I)(F)

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

What am I missing?

Try to define $HOME as a Windows environment variable.

See :h $HOME-windows

                            *$HOME-windows*
On MS-Windows, if $HOME is not defined as an environment variable, then
at runtime Vim will set it to the expansion of $HOMEDRIVE$HOMEPATH.
If $HOMEDRIVE is not set then $USERPROFILE is used.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM