Confused by when to use config vs opts #2096
-
|
Hello, I was setting up my neovim config and doing my best to follow the recommendation to always use opts instead of config when possible. to the end of my treesitter.lua it seems to work fine. I am confused as to why this was required, and if I need to do so for all of the plugins where I use opts={...} instead of Thanks for any help clarifying this! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
|
Maybe that |
Beta Was this translation helpful? Give feedback.
-
|
The main Lua module is the module where the That's why you either have to define |
Beta Was this translation helpful? Give feedback.
opts = {}means that the defaultconfigfunction will be used. The defaultconfigfunction will dorequire("main_lua_module").setup().The main Lua module is the module where the
setupfunction is defined and called upon. For the case ofnvim-treesitter(for master branch at least as it used to be the case), thesetupfunction was defined innvim-treesitter.configsmodule and notnvim-treesitter. By defaultlazy.nvimassumes that it's usually defined in the top-level module (that would benvim-treesitter, but not all plugins do that because it's just a convention after all and not followed through by all plugin authors as they might have different preferences with regards to the design of…