"Opts" Table Pass #3428
-
I recently learned that you can use both -- https://www.reddit.com/r/neovim/comments/14ue6x5/comment/jr7419o/?utm_source=share&utm_medium=web3x&utm_name=web3xcss&utm_term=1&utm_content=share_button
config = function(_, opts)
...
end It seems like we do a similar thing with
Is it possible to access that "setup code" (the table) in a function given to For example, plugins.X = {
settings = { foo = "bar"; };
lazyLoad.settings = {
# lz.n equivalent to config (lazy.nvim)
after =
# lua
''
function(opts) -- TODO: is there an optional argument here to access the "settings" table too?
-- setup the plugin with that table
require("X").setup(opts)
-- do something else
-- ...
end
'';
};
}; Or does it make more sense to do something like Thank you. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
By default, nixvim's plugins will put their So if you want to use Nixvim's plugin So:
is correct. If you define See nixvim/lib/plugins/mk-neovim-plugin.nix Lines 127 to 132 in d2c3b26 (Sorry for the late reply!) |
Beta Was this translation helpful? Give feedback.
By default, nixvim's plugins will put their
luaConfig
into lz-n'safter
(when lazyloading).So if you want to use Nixvim's plugin
settings
, you should put your "after" code inplugins.*.luaConfig
.So:
is correct.
If you define
plugins.*.lazyload.settings.after
explicitly for this plugin, then that overrides everything nixvim would've done. This effectively means yourplugins.*.settings
is ignored, and if you wanted to use it you'd have to usetoLuaObject
on it yourself.See
nixvim/lib/plugins/mk-neovim-plugin.nix
Lines 127 to 132 in d2c3b26