Filetype on or filetype off?

I am using the Pathogen for gvim . When setting up, I installed the following in my vimrc file:

 call pathogen#infect() call pathogen#helptags() call pathogen#runtime_append_all_bundles() filetype on "force reloading *after* pathogen loaded 

Now I am following this Youtube tutorial by Martin Brohouse to configure Vim to use Python and it offers the following:

 filetype off filetype plugin indent on syntax on 

I currently have filetype on for the pathogen, but it offers filetype off . What does this line of code do and how do I configure vimrc so that Pathogen and Python are happy?

+4
source share
3 answers

:filetype off is redundant when it immediately follows :filetype [plugin indent] on (since it again enables file type detection, as described in :help filetype-plugin-on ); Do not blindly trust arbitrary resources on the Internet :-)

Typically, you need file type detection (so that the appropriate syntax (using :syntax on ) can be loaded for highlighting) and file-specific parameters (part of the plugin ) and indent rules.

The only mistake with Pathogen is that this should happen after initializing Pathogen, but you did it right.

+7
source
 call pathogen#runtime_append_all_bundles() 

not required at all: the function is deprecated and not at all useful.

If you really need to be safe, this is what you should have at the top of your ~/.vimrc :

 " turn filetype detection off and, even if it 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 

However, I had a pretty long time:

 call pathogen#infect() call pathogen#helptags() filetype plugin indent on syntax on 
+7
source

filetype on allows you to detect file types. Setting the filetype plugin or filetype indent to on will detect the file type, if there is more to it. See :help filetype .

+4
source

Source: https://habr.com/ru/post/1491261/


All Articles