[Feature]: Add possibility to override plugin loading event #2300
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
It can be useful be able to override which event a core plugin should be loaded from the user configuration.
Add an
event
attribute to the default configuration of all core plugins that have an event configured and refer to that from the plugins module.This implements the approach suggested in #1692.
How Has This Been Tested?
My use case was to make
gitsigns.nvim
load on startup when not starting vim with a file as argument (not only whenBufRead
event is triggered).I use the gitsigns plugin to review all the changes of last commit by changing its base (e.g.
HEAD~1
).In my
config.lua
I override the default configuration like this:This makes the plugin available at start without having to open a file first.