junegunn / vim-plug

:hibiscus: Minimalist Vim Plugin Manager
https://junegunn.github.io/vim-plug/
MIT License
33.89k stars 1.9k forks source link

Add to wiki/documentation for how multiple options (ex 'for' languages) are parsed #1196

Open JWCS opened 2 years ago

JWCS commented 2 years ago

Anyway, for option was designed to take a string of a single file type or a list of multiple file types, and there's no code in vim-plug that processes comma-separated file types. It may not work correctly if you have multiple plugins with overlapping sets of for options.

Plug 'foo', { 'for': 'a,b,c' }
Plug 'bar', { 'for': 'b,c' }

When a file of type a is open, foo is loaded, and vim-plug will try to clear the hook by executing autocmd! PlugLOD Filetype a,b,c, which will cause the autocmds for bar to be cleared as well, and bar will never get loaded.

But if you specify the types as a list, vim-plug will correctly handle such cases.

Plug 'foo', { 'for': ['a', 'b', 'c'] }
Plug 'bar', { 'for': ['b', 'c'] }

Originally posted by @junegunn in https://github.com/junegunn/vim-plug/issues/259#issuecomment-122892087

This was the only (non-source code) documentation I could find on this. It would be helpful to add this to the wiki/documentation.