David542
David542

Reputation: 110572

How filetype plugin on changes loading

What occurs when the filetype plugin option is changed? For example, from the docs it says:

When loading filetype plugins has been enabled :filetype-plugin-on, options will be set and mappings defined.

Does this mean that if filetype plugin is off, then vim will not add certain directories to the vim runtime? Or what exactly does this parameter do, I'm a bit confused?

Upvotes: 0

Views: 125

Answers (1)

Matt
Matt

Reputation: 15196

What this command does, it simply loads a relevant script from $VIMRUNTIME.

For filetype plugin on it's $VIMRUNTIME/ftplugin.vim; for filetype plugin off it's $VIMRUNTIME/ftplugof.vim; for filetype off it's $VIMRUNTIME/ftoff.vim, and so on.

Basically ftoff.vim clears filetypedetect auto-group (the one which traps BufRead); and ftplugof.vim clears filetypeplugin group (then one which traps FileType).

I suggest to everyone who is interested in internals to explore the code himself. The source worth a thousand words.

Upvotes: 3

Related Questions