opts vs config
#1185
-
What's the execution order of Example: return {
"tanvirtin/monokai.nvim",
lazy = false,
priority = 1000,
config = function(_, _)
monokai = require("monokai")
palette = monokai.pro
opts = {
palette = monokai.pro
}
monokai.setup(opts)
end
} vs return {
"tanvirtin/monokai.nvim",
lazy = false,
priority = 1000,
opts = function(_, _)
monokai = require("monokai")
palette = monokai.pro
opts = {
palette = monokai.pro
}
return opts
end
} |
Beta Was this translation helpful? Give feedback.
Answered by
abeldekat
Nov 15, 2023
Replies: 3 comments 10 replies
-
I think if config exists, opts will be pass to config's first parameter |
Beta Was this translation helpful? Give feedback.
0 replies
-
The best answer can be found in the docs: plugin spec |
Beta Was this translation helpful? Give feedback.
4 replies
-
Also wondering what's the difference between config = true and opts = {} |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For your personal config, when there is only one spec for
monokai-pro
, they both are equivalent.When there are multiple specs for the plugin, one overriding the other, I think that option two is preferred.
An example , the overriding spec:
Another argument in favor of option two: You don't have to provide
monokai.setup(opts)
See also: importing specs ....
It's a crucial…