I think I'm not fully understanding the LazyLoad event key #1020
-
I feel like I must be missing something obvious, as I'm having trouble either understanding or implementing the "LazyLoad" user event. My goal is to ensure correct load order of Plugins are loading fine, just not in the right order -- invariably, it seems to be alphabetically by how each plugin/file is named. In the docs, the "LazyLoad" event is described as:
I've interpreted this as "plugins with the {
'neovim/nvim-lspconfig',
event = {
'LazyLoad',
data = {
'williamboman/mason.nvim'
},
},
config = function()
<...>
end
} but it doesn't seem to affect load order at all. I admit I'm not a lua expert, but I could also just be completely misunderstanding the function of the LazyLoad event. Much obliged for any help anyone can offer. :) Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
does event take a anyways i personally resolve load order by adding mason-lspconfig as a dependency for lspconfig and mason as a dependency for mason-lspconfig. Then i have a separate plugin spec for mason to un-lazyload it. my understanding is that after a plugin is loaded and before its config() is run, the dependencies are loaded and their configs are run. |
Beta Was this translation helpful? Give feedback.
-
Hello @plongitudes, The
The An example of its usage can be found in LazyVim. In this code fragment, the event is used to require the As @pynappo indicated, you can use the
You could peek at the Worth mentioning: An explanation on how dependencies are loaded, written by Folke in this issue. Best regards! |
Beta Was this translation helpful? Give feedback.
The
on_load
function inlazyvim.util
uses theLazyLoad
event broadcasted bylazy.nvim
, introduced in this commit: LazyLoadThe User Events section describes all
user events
triggered bylazy.nvim
during its various stages of processing.Most of those events, in my opinion, are not primarily intended to be used in the
event
property of your plugin spec. For example, it makes no sense to lazy-load your plugin on theUser LazyLog
event.VeryLazy
though, is most useful in the event property of your specs.Lazy.nvim
even translatese…