[英]Vim sourcing .vim files after .vimrc
Here is the snapshot for: scriptname
这是快照: scriptname
1: /etc/vimrc
2: /usr/share/vim/vim72/syntax/syntax.vim
3: /usr/share/vim/vim72/syntax/synload.vim
4: /usr/share/vim/vim72/syntax/syncolor.vim
5: /usr/share/vim/vim72/filetype.vim
6: /usr/share/vim/vim72/ftplugin.vim
7: /home/xxxxx/.vimrc
8: /usr/share/vim/vim72/syntax/nosyntax.vim
9: /usr/share/vim/vim72/indent.vim
10: /usr/share/vim/vim72/colors/desert.vim
11: /usr/share/vim/vim72/indoff.vim
12: /usr/share/vim/vim72/ftplugof.vim
13: /usr/share/vim/vim72/plugin/filetype.vim
14: /usr/share/vim/vim72/plugin/getscriptPlugin.vim
15: /usr/share/vim/vim72/plugin/gzip.vim
16: /usr/share/vim/vim72/plugin/matchparen.vim
17: /usr/share/vim/vim72/plugin/netrwPlugin.vim
18: /usr/share/vim/vim72/plugin/rrhelper.vim
19: /usr/share/vim/vim72/plugin/spellfile.vim
20: /usr/share/vim/vim72/plugin/tarPlugin.vim
21: /usr/share/vim/vim72/plugin/tohtml.vim
22: /usr/share/vim/vim72/plugin/vimballPlugin.vim
23: /usr/share/vim/vim72/plugin/zipPlugin.vim
24: /usr/share/vim/vim72/syntax/cpp.vim
25: /usr/share/vim/vim72/syntax/c.vim
26: /home/xxxxx/.vim/after/syntax/cpp.vim
On 7, my vimrc is being sourced and after that couple of.vim files are being sourced.在 7 日,我的 vimrc 正在被获取,之后那对 .vim 文件被获取。
How do I stop these default sourcing of.vim files?如何停止这些默认的 .vim 文件来源?
Use The Noplugin Option when starting Vim启动时使用 Noplugin 选项 Vim
Please look at the help file, :help starting
.请查看帮助文件, :help starting
。 BTW, the :help initialization
section is a good read too.顺便说一句, :help initialization
部分也很不错。
The section on --noplugin
describes the resulting options behavior: --noplugin
部分描述了生成的选项行为:
--noplugin Skip loading plugins. Resets the 'loadplugins' option.
Note that the |-u| argument may also disable loading plugins:
argument load: vimrc files plugins defaults.vim ~
(nothing) yes yes yes
-u NONE no no no
-u DEFAULTS no no yes
-u NORC no yes no
--noplugin yes no yes
Thus, Starting vim with this option will execute your vimrc, but not source plugins (though you will get defaults...):因此,使用此选项启动 vim 将执行您的 vimrc,但不会执行源插件(尽管您将获得默认值...):
vim --noplugin
As phd had indicated, your settings in your ~/.vimrc file are also responsible for the *.vim files being sourced as well (eg filetype settings, indentation, colorscheme).正如 phd 所指出的,您在 ~/.vimrc 文件中的设置也负责 *.vim 文件的来源(例如文件类型设置、缩进、颜色方案)。
When I execute the ex command (Vim 8.2 on Windows 10), :scriptname
, I get:当我执行 ex 命令(Windows 10 上的 Vim 8.2)时, :scriptname
,我得到:
1: ~\_vimrc
2: C:\Program Files\Vim\vim82\vim82\filetype.vim
3: C:\Program Files\Vim\vim82\vim82\ftplugin.vim
4: C:\Program Files\Vim\vim82\vim82\indent.vim
5: C:\Program Files\Vim\vim82\vim82\syntax\syntax.vim
6: C:\Program Files\Vim\vim82\vim82\syntax\synload.vim
7: C:\Program Files\Vim\vim82\vim82\syntax\syncolor.vim
8: C:\Program Files\Vim\vim82\vim82\colors\murphy.vim
9: C:\Program Files\Vim\vim82\vim82\ftplugin\help.vim
10: C:\Program Files\Vim\vim82\vim82\syntax\help.vim
Press ENTER or type command to continue
Vim Verbose Logging Can Provide a Detailed Perspective on Plug-in Sourcing Vim 详细日志记录可以提供插件采购的详细视角
When starting Vim, you can use the verbose option with the verbosefile set, you can view the initialization process in as detailed a manner as you would like.启动Vim时,可以使用verbose选项,设置verbosefile,可以详细查看初始化过程。
the :help -V
entry: :help -V
条目:
-V[N] Verbose. Sets the 'verbose' option to [N] (default: 10).
Messages will be given for each file that is ":source"d and
for reading or writing a viminfo file. Can be used to find
out what is happening upon startup and exit.
Example:
vim -V8 foobar
I started my vim session with vim --noplugin -V6vim_logging6.txt
(here N can be 1 to 10 (10 being the most logging)).我用vim --noplugin -V6vim_logging6.txt
(这里 N 可以是 1 到 10(10 是最多的日志记录))。 Also, I set the logging file, verbosefile, to "logging6.txt".此外,我将日志文件 verbosefile 设置为“logging6.txt”。
For our purposes of viewing the sourcing, I scrape the log file with this ex command to view just the sourcing:为了我们查看来源的目的,我使用这个 ex 命令抓取日志文件以仅查看来源:
:v/^line \d\+/d
I can then view the sequential sourcing only from the log file:然后我只能从日志文件中查看顺序来源:
1 line 28: sourcing "/usr/local/share/vim/vim82/filetype.vim"
2 line 28: sourcing "/usr/local/share/vim/vim82/ftplugin.vim"
3 line 29: sourcing "/usr/local/share/vim/vim82/filetype.vim"
4 line 29: sourcing "/usr/local/share/vim/vim82/ftplugin.vim"
5 line 29: sourcing "/usr/local/share/vim/vim82/indent.vim"
6 line 30: sourcing "/usr/local/share/vim/vim82/syntax/syntax.vim"
7 line 19: sourcing "/usr/local/share/vim/vim82/syntax/synload.vim"
8 line 21: sourcing "/usr/local/share/vim/vim82/syntax/syncolor.vim"
9 line 66: sourcing "/usr/local/share/vim/vim82/colors/murphy.vim"
10 line 7: sourcing "/usr/local/share/vim/vim82/syntax/syncolor.vim"
11 line 8: sourcing "/usr/local/share/vim/vim82/syntax/syncolor.vim"
12 line 10: sourcing "/usr/local/share/vim/vim82/syntax/syncolor.vim"
13 line 119: sourcing "/home/pbacon/.vimrc.plug"
14 line 1: sourcing "/home/pbacon/.vim/autoload/plug.vim"
15 line 14: sourcing "/usr/local/share/vim/vim82/ftoff.vim"
16 line 83: sourcing "/usr/local/share/vim/vim82/filetype.vim"
17 line 83: sourcing "/usr/local/share/vim/vim82/ftplugin.vim"
18 line 83: sourcing "/usr/local/share/vim/vim82/indent.vim"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.