简体   繁体   English

Windows 10 上的 Vim/gVim 8.1 不会获取 $HOME\_vimrc

[英]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 .我有一个$HOME\_vimrc存在,但它没有出现在:scriptnames的 output 中。 And when I run gvim -V , it reports:当我运行gvim -V时,它会报告:

could not source "$HOME\_vimrc"

The only thing in my $HOME\_vimrc is the following line:我的$HOME\_vimrc中唯一的内容是以下行:

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:如果该路径有问题,我还将$HOME\_vimrc文件的全部内容更改为此,结果相同:

set number

When I run :echo $HOME from gvim, it reports my Windows user profile directory C:\Users\username .当我从 gvim 运行:echo $HOME时,它会报告我的 Windows 用户配置文件目录C:\Users\username I have a $HOME\_gvimrc which it reads fine.我有一个$HOME\_gvimrc ,它读起来很好。 My vimfiles directory is at the default $HOME\vimfiles which it seems to read fine, because it's sourcing a color scheme from there.我的 vimfiles 目录位于默认的$HOME\vimfiles中,它似乎读起来很好,因为它从那里获取配色方案。

Running :version shows the following entries:运行:version显示以下条目:

   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 .运行:echo $MYVIMRC输出C:\Program Files (x86)\Vim\_vimrc

I've tried running as both administrator and my Windows username.我试过以管理员和我的 Windows 用户名运行。

Someone suggested that I run icacls _vimrc to see the file permissions.有人建议我运行icacls _vimrc来查看文件权限。 Here's the output:这是 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.最后一个条目DOMAIN\username是我用来运行 gVim 的登录名。

What am I missing?我错过了什么?

Try to define $HOME as a Windows environment variable.尝试将$HOME定义为 Windows 环境变量。

See :h $HOME-windows: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.

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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