今天,我发现我.vimrc
没有生效。几小时前还可以。
当我用启动vim时$vim --plugin
,:scriptnames
没有回声:.vimrc
文件不是源文件。(注意:/etc/vimrc
已删除,以调试此问题。)
然后,我尝试使用google并发现$VIMINIT
变量可疑。
这是值$VIMINIT
:
$ echo $VIMINIT
set number
Vim文档VIMINIT
:
c. Four places are searched for initializations. The first that exists
is used, the others are ignored. The $MYVIMRC environment variable is
set to the file that was first found, unless $MYVIMRC was already set.
- The environment variable VIMINIT (see also |compatible-default|) (*)
The value of $VIMINIT is used as an Ex command line.
- The user vimrc file(s):
"$HOME/.vimrc" (for Unix and OS/2) (*)
"s:.vimrc" (for Amiga) (*)
"home:.vimrc" (for Amiga) (*)
"$VIM/.vimrc" (for OS/2 and Amiga) (*)
"$HOME/_vimrc" (for MS-DOS and Win32) (*)
"$VIM/_vimrc" (for MS-DOS and Win32) (*)
Note: For Unix, OS/2 and Amiga, when ".vimrc" does not exist,
"_vimrc" is also tried, in case an MS-DOS compatible file
system is used. For MS-DOS and Win32 ".vimrc" is checked
after "_vimrc", in case long file names are used.
Note: For MS-DOS and Win32, "$HOME" is checked first. If no
"_vimrc" or ".vimrc" is found there, "$VIM" is tried.
See |$VIM| for when $VIM is not set.
- The environment variable EXINIT.
The value of $EXINIT is used as an Ex command line.
- The user exrc file(s). Same as for the user vimrc file, but with
"vimrc" replaced by "exrc". But only one of ".exrc" and "_exrc" is
used, depending on the system. And without the (*)!
我无法完全理解vim文档。似乎$VIMINIT
可能会破坏vim的启动。
清除$VIMINIT
:
$ VIMINIT=
$ echo $VIMINIT
问题仍然存在。
$VIMINIT
优先于任何.vimrc
文件。它满足先到先得的规则。因此,是的.vimrc
被忽略。