Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dependencies between lazy loaded plugins #145

Closed
barthalion opened this issue Jan 16, 2015 · 5 comments
Closed

Dependencies between lazy loaded plugins #145

barthalion opened this issue Jan 16, 2015 · 5 comments

Comments

@barthalion
Copy link

I want to lazy load CtrlP and its external plugin Funky. I expected the following snippet to load both CtrlP and Funky when :CtrlPFunky is called:

Plug 'ctrlpvim/ctrlp.vim', { 'on': [ 'CtrlP', 'CtrlPFunky' ] },
Plug 'tacahiroy/ctrlp-funky', { 'on': 'CtrlPFunky' }

Unfortunately it results in:

E492: Not an editor command: CtrlPFunky

It also happens with Airline and plugins it supports. Is there anything that can be done about it?

@junegunn
Copy link
Owner

Hmm right, they shouldn't work. on option defines a proxy command for loading the plugin and rerunning the command from the loaded plugin. The second line in your case overrides the proxy command CtrlPFunky defined from the first line. It is possible that we make vim-plug not to override the previous one but to build the list of plugins to be loaded. Not sure if it's worth the effort though.

At the moment, you can define a proxy command yourself which calls plug#load() function.

Plug 'ctrlpvim/ctrlp.vim', { 'on': 'CtrlP' }
Plug 'tacahiroy/ctrlp-funky', { 'on': [] }

command! CtrlPFunky call plug#load('ctrlp.vim', 'ctrlp-funky') | CtrlPFunky

@junegunn
Copy link
Owner

@barthalion Updated vim-plug to handle such cases. Please upgrade vim-plug and let me know if it doesn't work as expected. Thanks!

@barthalion
Copy link
Author

Thank you, works like a charm.

@alem0lars
Copy link

alem0lars commented Apr 19, 2016

@junegunn What is the order between the plugins loaded by CtrlPFunky? The same as the line order?

Because in some cases, it's mandatory that the dependency gets loaded before the dependant.

For example with:

Plug 'ctrlpvim/ctrlp.vim', { 'on': [ 'CtrlP', 'CtrlPFunky' ] },
Plug 'tacahiroy/ctrlp-funky', { 'on': 'CtrlPFunky' }

The ctrlp plugin is loaded before ctrlp-funky plugin because it's in the line above ?

@junegunn
Copy link
Owner

@alem0lars Yes.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants