gpt4 book ai didi

vim - 插件是由vimrc加载还是之后加载?

转载 作者:行者123 更新时间:2023-12-02 05:48:01 31 4
gpt4 key购买 nike

我对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/

    31 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com