为什么vundle需要关闭文件类型

Way*_* Ye 25 vim less coffeescript

在vundle的主页上,它记录了它需要在.vimrc中关闭文件类型:

 filetype off                   " required!
 set rtp+=~/.vim/bundle/vundle/
 call vundle#rc()
Run Code Online (Sandbox Code Playgroud)

我不明白为什么.由于我在为它们单独安装相关插件(vim-coffee-script和vim-less)后最近编辑.coffee和.less文件时遇到问题.关于vim-coffee-script的问题

Max*_*Kim 28

您可以filetype on在最后一个Vundle命令后设置:

 filetype off                   " required!
 set rtp+=~/.vim/bundle/vundle/
 call vundle#rc()
 ...
 Vundle 'blabla'
 Vundle 'blabla2'

 filetype plugin indent on   " re-enable filetype
Run Code Online (Sandbox Code Playgroud)

  • 但这并没有回答为什么。 (3认同)

sud*_*ang 9

我想解决这个问题的部分原因.

大多数答案来自以下github线程

https://github.com/VundleVim/Vundle.vim/issues/176

这是Vim的特色.
Vim从runtimepath为文件类型插件创建缓存.因此,如果vundle更改了runtimepath,它必须在调用之前重置.

还有人说,这个问题只存在于7.3.430之前.

正如@Maxim Kim所回答的那样,在与Vundle相关的所有内容之后,最好将其打开

set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()

" Let vundle manage itself:
Plugin 'VundleVim/Vundle.vim'
" Syntax checking plugin
Plugin 'scrooloose/syntastic'

call vundle#end() 

filetype plugin indent on " Filetype auto-detection
syntax on " Syntax highlighting
Run Code Online (Sandbox Code Playgroud)