LazyVim/lazyvim.github.io

General Settings: "automatically loaded" may deserve more explanation

osamuaoki opened this issue · 2 comments

Just mentioning "automatically loaded" may deserve more explanation.

I think explicitly mentioning vim.tbl_deep_extend("force",...,...) should remove ambiguity even for novice lua user like me.

I am thinking along ...

The files autocmds.lua, keymaps.lua, lazy.lua and options.lua under lua/config will be automatically loaded at the appropriate time, so you don't need to require those files manually. This user override mechanism is implemented by using code such as options = vim.tbl_deep_extend("force", defaults, opts or {}). LazyVim comes with a set of default config files providing defaults table and their table contents are overridden by your own config files providing opts table.

folke commented

That's not really correct. Those files will simply be loaded at the appropriate time. There's not merging of tables or anything like that

Excuse me for my sloppy expression. I agree they are loaded at appropriate time.

But before using the user provided configuration generated table, aren't they merged with LazyVim default generated table to generate effective configuration table at around line 180-182 in
https://github.com/folke/lazy.nvim/blob/main/lua/lazy/core/config.lua

---@param opts? LazyConfig
function M.setup(opts)
  M.options = vim.tbl_deep_extend("force", M.defaults, opts or {})

Without knowing this mechanism to generate the effective table behind the scene, I wasn't sure how much I need to specify or use nil in the user configuration.