Hi everyone,
I’m really new to the whole neovim thing and I’m figuring out my way to setup a good environment for my programming needs. I’m following this awesom youtube tutorial by chris@machine I’m using lazy.nvim as my plugin manager and when trying to install nvim-cmp I found that I need to configure it and when searching on how. there where multiple ways :
- editing the opts spec in lazy.nvim
return
{
"hrsh7th/nvim-cmp",
opts = function(_, opts)
-- configurations
end,
}
what does opts = function(_, opts)
mean, and how it’s actually called?
- editing the config spec in lazy.nvim
{
"hrsh7th/nvim-cmp",
config = function()
-- configurations
end,
}
what is the different between config
and opts
?
- the last one was by chris@machine on his repo nvim-basic-ide which is an update one from the one he is using in the tutorial, but basically his way is like that
local M = {
"hrsh7th/nvim-cmp",
}
function M.config()
-- configurations
end
return M
like what M.config()
means? when it will get executed ?
I read the lazy.nvim github docs about opts and config but I didn’t fully understand everything and I feel they are the same thing and I tried to search online but I didn’t find any thing useful?
I’m just trying to understand what I’m doing and not just copy pasting from online dotfiles
sorry for the long post