我对Vim加载插件文件的顺序感到困惑,并且似乎在网上找到混合的答案。 Some answers似乎建议在插件之前先加载vimrc,而others建议在vimrc的获取过程中在filetype plugin indent on
行加载。有人可以说明一下after /目录中的vimrc,插件和插件的加载顺序,是什么原因导致加载的,以及在vim session 中何时可以重新加载它们(例如,再次采购vimrc时会发生什么情况,何时进行?设置文件类型等)?
最佳答案
Some answers seem to suggest that vimrc is loaded before plugins, while others suggest that they are loaded during the sourcing of vimrc, at the line filetype plugin indent on.
除非您手动获取所有插件,否则它们均在
vimrc
之后获取(正确的术语)。 filetype plugin indent on
行不会更改该顺序。Can someone please clarify the order in which vimrc, plugins, and plugins in the after/ directory are loaded,
假设您的
filetype plugin indent on
中包含vimrc
:vimrc
(如果有)。 vimrc
。 after/
目录中。 整个过程在
:help startup
中进行了解释,并且可以通过:scriptnames
清楚地看到。what causes each to load,
一般而言,
&runtimepath
的值以及特定于文件类型的内容的:filetype
命令的值。and when each could be reloaded during a vim session (e.g. what happens when sourcing vimrc again, what happens when setting the filetype, etc.)?
:source $MYVIMRC
重新执行vimrc
中的每个命令。 :help :filetype
。 关于vim - 插件是由vimrc加载还是之后加载?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42823310/