空.vimrc导致某些脚本无法加载?

时间:2016-12-16 23:11:22

标签: vim vim-plugin

如果没有〜/ .vimrc ,我在vim中运行dict=True时会得到以下列表

:scriptnames

但是,如果我只是触摸〜/ .vimrc ,我的 1: /usr/local/Cellar/vim/8.0.0134/share/vim/vim80/defaults.vim 2: /usr/local/Cellar/vim/8.0.0134/share/vim/vim80/syntax/syntax.vim 3: /usr/local/Cellar/vim/8.0.0134/share/vim/vim80/syntax/synload.vim 4: /usr/local/Cellar/vim/8.0.0134/share/vim/vim80/syntax/syncolor.vim 5: /usr/local/Cellar/vim/8.0.0134/share/vim/vim80/filetype.vim 6: /usr/local/Cellar/vim/8.0.0134/share/vim/vim80/ftplugin.vim 7: /usr/local/Cellar/vim/8.0.0134/share/vim/vim80/indent.vim 8: /usr/local/Cellar/vim/8.0.0134/share/vim/vim80/plugin/getscriptPlugin.vim 9: /usr/local/Cellar/vim/8.0.0134/share/vim/vim80/plugin/gzip.vim 10: /usr/local/Cellar/vim/8.0.0134/share/vim/vim80/plugin/logiPat.vim 11: /usr/local/Cellar/vim/8.0.0134/share/vim/vim80/plugin/manpager.vim 12: /usr/local/Cellar/vim/8.0.0134/share/vim/vim80/plugin/matchparen.vim 13: /usr/local/Cellar/vim/8.0.0134/share/vim/vim80/plugin/netrwPlugin.vim 14: /usr/local/Cellar/vim/8.0.0134/share/vim/vim80/plugin/rrhelper.vim 15: /usr/local/Cellar/vim/8.0.0134/share/vim/vim80/plugin/spellfile.vim 16: /usr/local/Cellar/vim/8.0.0134/share/vim/vim80/plugin/tarPlugin.vim 17: /usr/local/Cellar/vim/8.0.0134/share/vim/vim80/plugin/tohtml.vim 18: /usr/local/Cellar/vim/8.0.0134/share/vim/vim80/plugin/vimballPlugin.vim 19: /usr/local/Cellar/vim/8.0.0134/share/vim/vim80/plugin/zipPlugin.vim 会变成这个

:scriptnames

是什么导致vim跳过默认插件? 我真的很喜欢默认设置,我可以在不覆盖默认设置的情况下保留vimrc文件中的更改设置吗?

1 个答案:

答案 0 :(得分:3)

如果没有vimrc,Vim将加载/usr/share/vim/vim80/defaults.vim。你可以看到第一行:

1: /usr/local/Cellar/vim/8.0.0134/share/vim/vim80/defaults.vim

您的第二个:scriptnames输出中缺少

来自:help defaults.vim

If Vim is started normally and no user vimrc file is found, the
$VIMRUTIME/defaults.vim script is loaded.

[...]

This should work well for new Vim users.  If you create your own .vimrc, it is
recommended to add this line somewhere near the top:
        unlet! skip_defaults_vim
        source $VIMRUNTIME/defaults.vim

请注意,这仅适用于 到Vim 8. Vim 7.4及更早版本没有附带defaults.vim文件。