Why vundle requires filetype off
Asked Answered
O

3

27

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

Orva answered 1/2, 2013 at 9:14 Comment(3)
It seems to be a workaround. I suggest you ask over there.Laritalariviere
I've posted an update on the github issue mentioned by @LaritalariviereGrogan
I have it enabled back in my vimrc after the vundle initializations (seen no problem).Ruhr
B
29

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
Biyearly answered 11/6, 2013 at 13:39 Comment(2)
For me, just re-enabling the filetype after vuncle#end() did not solve the issue. I also add 'syntax enable'. as @sudo-bangbang said in next response.Panel
This doesn't answer why, though.Jenevajeni
C
13

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
Caprine answered 7/12, 2016 at 14:26 Comment(0)
S
0

This is the answer to your WHY, I took it from Vundle's contributor. Basically, what he meant is you need to turn of off to avoid unexpected behaviors when Bundle commands are running. And after that, you can turn it back on.

After the bundles block. File type detection must be enabled after the Bundles block because the runtime path is updated by every Bundle command and that could potentially bring new file types or more plugins for specific file types. It also appears that turning it on, when it's on, does nothing, so it must be turned off before.

If you are reluctant to turn it off because it affects some file type detection, please try a newer vim version, with the 430th patch (quite unluckily, Ubuntu picked up only up to the patch right before that one.)

Sterne answered 6/11, 2020 at 6:36 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.