我使用Pathogen插件gvim.配置时我在我的vimrc文件中设置以下内容:
call pathogen#infect()
call pathogen#helptags()
call pathogen#runtime_append_all_bundles()
filetype on "force reloading *after* pathogen loaded
Run Code Online (Sandbox Code Playgroud)
现在我在Martin Brochhaus的Youtube上关注这个教程,设置Vim对Python编码很有用,他建议如下:
filetype off
filetype plugin indent on
syntax on
Run Code Online (Sandbox Code Playgroud)
所以目前我有filetype on病原体,但他建议filetype off.这行代码做了什么,我应该如何配置,vimrc所以Pathogen和Python都很开心?
在:filetype off当紧接着是多余的:filetype [plugin indent] on(因为它打开文件类型检测再次,如在描述的:help filetype-plugin-on); 不要盲目相信互联网上的任意资源:-)
您通常需要检测文件类型(以便可以加载相应的语法以突出显示(with :syntax on)),以及特定于文件类型的设置(plugin部分)和缩进规则(indent).
病原体的唯一缺陷是这应该在病原体初始化之后,但你已经做到了这一点.
call pathogen#runtime_append_all_bundles()
Run Code Online (Sandbox Code Playgroud)
根本不需要:该函数已被弃用,无论如何都没有用.
如果你真的需要安全,那么你应该拥有最好的东西~/.vimrc:
" turn filetype detection off and, even if it's not strictly
" necessary, disable loading of indent scripts and filetype plugins
filetype off
filetype plugin indent off
" pathogen runntime injection and help indexing
call pathogen#infect()
call pathogen#helptags()
" turn filetype detection, indent scripts and filetype plugins on
" and syntax highlighting too
filetype plugin indent on
syntax on
Run Code Online (Sandbox Code Playgroud)
但是,我有很长一段时间没有任何明显的问题:
call pathogen#infect()
call pathogen#helptags()
filetype plugin indent on
syntax on
Run Code Online (Sandbox Code Playgroud)