Skip to content

Help with deep (recursive) merging #2056

Answered by jneem
axyz asked this question in Q&A
Sep 27, 2024 · 2 comments · 7 replies
Discussion options

You must be logged in to vote

I think your approach is basically fine, but you've misunderstood the behavior of default: since dark is marked as default within themes, when you merge themes with { dark = blah }, the blah "wins" and completely overwrites the previous settings in themes.dark.

I'm sorry that the previous sentence isn't very clear; I'm having trouble figuring out a better way to explain it. But here's an example:

{ a | default = { b = 1, c = 2 } } & { a = { b = 2 } }
# => { a = { b = 2 } }

because the default value of a is overridden by the higher-priority value { b = 2 }. If you want to do recursive merging instead of overriding, you need the two as to have the same priority instead of having one as the…

Replies: 2 comments 7 replies

Comment options

You must be logged in to vote
5 replies
@axyz
Comment options

@axyz
Comment options

@yannham
Comment options

@yannham
Comment options

@yannham
Comment options

Answer selected by axyz
Comment options

You must be logged in to vote
2 replies
@axyz
Comment options

@yannham
Comment options

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