Closed hoofcushion closed 2 months ago
Advantage: (generated by GPT)
Decoupling Plugin Dependencies: It allows for the linking of plugins that do not have direct dependencies on each other. This is particularly useful when the functionality of one plugin needs to be integrated with another, but the relationship isn't naturally one of dependency.
Controlled Initialization Order: The feature provides a way to manage the initialization order of plugins more flexibly. Even if the outer plugin is loaded, dependencies can be managed such that they are not forced to load unless necessary, providing better control over the plugin load sequence.
Enhanced Customization: Users can define custom logic that should be executed only after certain plugins are loaded. This is useful for setting up configurations that involve multiple plugins, where the setup of one plugin may need to wait for another to be ready.
Simplified Plugin Management: By using a hook function, users can encapsulate the logic for linking plugins into a single, manageable function. This simplifies the overall plugin management and reduces the complexity of the configuration scripts.
Dynamic Configuration: The hook function can dynamically adjust the configuration of one plugin based on the presence and state of another. This allows for more complex and interactive setups that can adapt to the specific plugins that are being used.
Improved User Experience: For end-users, this feature can lead to a smoother experience as it enables better integration between plugins, potentially reducing conflicts and ensuring that plugins work together seamlessly.
Sorry, but no
Did you check the docs?
Is your feature request related to a problem? Please describe.
If there is linkage between plugins, and the plugins do not depend on each other, then a hook function is necessary to execute the linkage logic between the plugins. Or it will be hard to manage the loading order of plugins by using the
dependencies
, because when the outer plugin were loaded, all dependencies will be force load too even they are not depend on each other.Describe the solution you'd like
The user input will look like this:
Explain: when
LuaSnip
and`nvim-cmp
are both loaded, the hook function will be executed right after it, and the order doesn't matter.The logic part will look like this:
Explain: when any plugin is loaded, try to iterate all hooks and set the cond of the plugin to nil, when all cond is satisfied (all nil), execute the hook function and remove the hook spec.
Describe alternatives you've considered
past
Additional context
These are some useful hook function I have.