Repository navigation
Don't fail to merge abbreviations that the user already defined - #1296
Merged
fdncred merged 1 commit intoOct 21, 2026
Merged
Conversation
All the `*-abbreviations.nu` files merged their abbreviations with
`{...$abbreviations ...$env.config.abbreviations}`. If the user had
already defined any of those abbreviations (for example in
`config.nu`, before sourcing the file, or by sourcing the same file
twice), nushell rejects the record literal with:
Error: nu::shell::column_defined_twice
x Record field or table column used twice: grbm
`merge` keeps the same precedence (the user's value wins) without
erroring on duplicate keys.
Contributor
|
good idea. ping me when you're ready |
DavSanchez
marked this pull request as ready for review
October 21, 2026 17:22
Contributor
Author
|
@fdncred ready for review! |
Contributor
|
Thanks |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The abbreviation files merge their contents into the user's config with a
record spread:
That precedence (user config wins) is right, but the spread errors when a
key exists in both records instead of overriding it:
So a user cannot override an abbreviation before sourcing the file (which
is the documented way to keep config in
config.nu), and sourcing the samefile twice fails too.
mergekeeps the same precedence and doesn't care about duplicate keys:Verified on nushell 0.116.1 for all six abbreviation files: sourcing twice and
pre-defining a key both work, and the user's value still wins.