ftp,病原体和ftplugin文件的加载顺序

Jim*_*art 6 vim python-mode pathogen

我已经使用Vim和病原体一段时间了,事情进展顺利,但最近我开始使用我的ftplugin配置加载订单问题.

我现在遇到的具体问题是python-mode覆盖了我的ftplugin设置.我有一个~/.vim/ftplugin/python.vim包含以下行:

setlocal textwidth=119
Run Code Online (Sandbox Code Playgroud)

python-mode附带了自己的ftplugin文件,该文件也设置textwidth~/.vim/bundle/python-mode/ftplugin/python/pymode.vim.

问题是Vim现在正在我的ftplugin文件之后加载python-mode的ftplugin文件,所以我最终得到了它textwidth=79.我最近不得不重新安装MacPorts,我认为库存配置必须改变.

我尝试了各种技巧,包括在调用病原体之前关闭文件类型/插件检测,根据其他各种 答案,但没有一个能帮助.

通过使用verbose set textwidth?和一些echomsg调试,我知道两个ftplugin文件都被调用,并且它们被错误地调用(根据我的需要).

有没有办法迫使Vim/pathogen在插件之后调用我的ftplugin文件?

我甚至尝试将我的设置放入~/.vim/after/plugin/pymode.vim,但是在病原体设置插件后立即加载,所以它仍然在ftplugin文件之前运行,只有在我编辑Python文件后才会加载.

Jim*_*art 8

事实证明,这可能从未像我想象的那样发挥作用.我没有意识到Vim也支持~/.vim/after/ftplugin,所以我能够移动我的覆盖~/.vim/after/ftplugin/python.vim并获得我期待的行为.我不愿在SO上回答我自己的问题,但希望这会对其他人有所帮助.

  • 我认为特别鼓励回答一个人自己的问题.http://stackoverflow.com/help/self-answer (2认同)

Sam*_*eer 6

Plain Vim 按字母顺序加载插件脚本。这是从:help load-plugins

... all directories in the 'runtimepath' option will be
searched for the "plugin" sub-directory and all files ending in ".vim"
will be sourced (in alphabetical order per directory), also in
subdirectories.
Run Code Online (Sandbox Code Playgroud)

因此,您可以通过重命名<filetype>_plugin.vim为来设置插件加载顺序<filetype>/35plugin.vim。35是您所需的加载顺序。我认为这也应该通过重命名内部的插件目录来与Pathogen一起使用bundle,但我尚未对其进行测试。