show component only if corresponding plugin is already loaded #1361
Unanswered
gennaro-tedesco
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a lualine component that shows a specific statusline containing a plugin variable; however such plugin isn't always loaded at startup (but rather lazy loaded on specific conditions). By introducing such statusline component, instead, the plugin is automatically loaded by lualine even if I specify the condition to only require if loaded already.
Essentially what I do is the following:
it seems that the condition
package.loaded["my-plugin"] ~= nil
is not evaluated before, ratherrequire("my-plugin").value
is executed anyway.What is the recommended way to write such logic, namely to show plugin components only upon conditions that said plugins are already loaded (otherwise it would defy the entire concept of lazy loading)?
Beta Was this translation helpful? Give feedback.
All reactions