Why vundle requires filetype off

对着背影说爱祢 提交于 2019-12-19 05:05:09

问题


On vundle's homepage, it documented that it requires filetype to be off in .vimrc:

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

I don't understand why. Since I am encountering problems with editing .coffee and .less files recently after separately-installed related plugins for them (vim-coffee-script and vim-less). My issue on vim-coffee-script


回答1:


You can set filetype on after the last Vundle command:

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

 filetype plugin indent on   " re-enable filetype



回答2:


I wanted to address the why part of this problem.

Most of this answer is from the following github thread

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

It is Vim's feature.
Vim makes cache for filetype plugins from runtimepath. So if vundle changes runtimepath, it must reset before calling.

It's also said there that this problem was only there before 7.3.430.

As @Maxim Kim has answered, its better to turn it on after everything related to 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


来源:https://stackoverflow.com/questions/14642956/why-vundle-requires-filetype-off

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!