Shougo / dein.vim

:zap: Dark powered Vim/Neovim plugin manager
MIT License
3.43k stars 198 forks source link

Expose top-level ftplugin interface in VimScript #368

Closed bb010g closed 4 years ago

bb010g commented 4 years ago

Problems summary

TOML configuration (via dein#load_toml()) supports top-level ftplugin configuration, directly calling dein.vim/autoload/dein/parse.vim's s:merge_ftplugin():

https://github.com/Shougo/dein.vim/blob/9d78da821434d7bd794c956b60d7e1e314ebd61c/autoload/dein/parse.vim#L174-L176

The only other place this s:merge_ftplugin() is exposed is normal plugin configuration, via dein#parse#_add(), requiring a chaperoning plugin:

https://github.com/Shougo/dein.vim/blob/9d78da821434d7bd794c956b60d7e1e314ebd61c/autoload/dein/parse.vim#L35-L37

Expected

I can call a public function from VimScript that acts equivalently to a top-level ftplugin table under the TOML syntax.

Currently, you can bodge by copying out s:merge_ftplugin() and mutating g:dein#_ftplugin in the same way, but that's relying on dein's private internals.

Shougo commented 4 years ago

I don't know why the feature is really needed. Please explain it more clearly.

bb010g commented 4 years ago

Why do you use a deinft.toml file, instead of otherwise attaching the filetype initializations to plugins in dein.toml or deinlazy.toml, or handling it all detached from dein in VimScript (e.g. a ftplugin.rc.vim)?

I'm just wanting the same functionality, but divorced from the slower cost of TOML parsing.

Shougo commented 4 years ago

Why do you use a deinft.toml file, instead of otherwise attaching the filetype initializations to plugins in dein.toml or deinlazy.toml, or handling it all detached from dein in VimScript (e.g. a ftplugin.rc.vim)?

Because, I want to split global configuration from plugin configuration. And using toml is better for me.

Shougo commented 4 years ago

I'm just wanting the same functionality, but divorced from the slower cost of TOML parsing.

TOML parsing cost is not high because if you use dein#save_state()/dein#load_state(), it is not parsed everytime.

Shougo commented 4 years ago

I can expose g:dein#ftplugin for Vim script users. But I don't think it is useful.

User must write ftplugin configuration by string. It is not easy to write than toml.

For example:

let g:ftplugin = {
'vim': "echomsg 'hoge'"
}
Shougo commented 4 years ago

If you have better interface, please explain it for me.

Shougo commented 4 years ago

No response? If so, I will close it.