Closed 4e554c4c closed 2 years ago
Thanks. This looks pretty reasonable. I'm not really happy with the way we have config now in some other ways which is #39 but this definitely looks like an improvement! Let me know when/if it's ready to review.
should be good to review now, thanks :)
Looks great! Really appreciated.
It turns out that most of these come from the
_DEFAULTS
pattern. This is because of the following: original state:after configuration with empty table,
tbl = vim.tbl_extend(tbl._DEFAULTS, {})
which practically replacestbl
bytbl._DEFAULTS
:after this, the next call to
vim.tbl_extend(tbl._DEFAULTS, {})
fails, astbl._DEFAULTS
is nil.The solution to this is to just call
vim.tbl_extend(tbl, ...)
and store the defaults intbl
itself. The._DEFAULTS
field can be preserved by copying to it after initialization.Also
command
has been replaced withcommand!
in vimscript andautocmd
s have been wrapped in anaugroup
which resets its state each call. This is also common practice that avoids duplicate autocommands.Fixes https://github.com/Julian/lean.nvim/issues/145