Skip to content

Could someone please elucidate how "merging" specs works and what "parent specs" are? #1706

Answered by dpetka2001
NiklasKappel asked this question in Q&A
Discussion options

You must be logged in to vote

The problem in your case is that only key-value tables can be merged. list-like tables will be overridden normally (and which-key opts.spec is a list-like table).

But lazy.nvim has another fairly recent feature and that is opts_extend. With this you can define list-like tables that will be merged by lazy.nvim as well instead of overwritten. That is what LazyVim also uses (see here).

But you should make sure that opts_extend is present in the parent spec (I believe?? Not 100% sure about that). lazy.nvim parses the files alphabetically, so the first file that will be parsed and has a which-key spec in it will be considered as the parent spec.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@NiklasKappel
Comment options

Answer selected by NiklasKappel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants