Skip to content

make $env.config show default configuration when not set even with nu -n - #18747

Merged
fdncred merged 2 commits into
nushell:mainfrom
fdncred:make_defaults_viewable
Jul 28, 2026
Merged

fdncred merged 2 commits into
nushell:mainfrom
fdncred:make_defaults_viewable

Conversation

@fdncred

@fdncred fdncred commented Jul 27, 2026 •

Copy link
Copy Markdown
Contributor

Description

This PR has been a long time coming. It finally shows most of the default config settings when you inspect them with $env.confg even if you haven't sourced any config.nu files.

User-facing changes (Release notes)

Now it's easier to see what the default settings are when you don't have them configured. Show (nearly) all settings in $env.config. If you haven't set any, or launched with nu -n, it will show defaults.

Additional notes

For posterity, here are the things I found that are not contained in the $env.config.

  • $env.PROMPT_* (could change soon)
  • LS_COLORS default and $env.LS_COLORS
  • $env.VISUAL / $env.EDITOR
  • $env.config.buffer_editor: null — falls back to $env.VISUAL / $env.EDITOR
  • Visual selection reverse style is hard-coded in REPL
  • Parts of $env.config.use_ansi_coloring, namely $env.NO_COLOR, $env.FORCE_COLOR
  • Filesize locale determined by system locale
  • $env.config.datetime_format.normal / .table default to null, but display is hard-coded (RFC2822 + human / chrono_humanize).
  • reedline vi keybindings and some emacs bindings
  • $env.config.history.path: "" — means “use default under config home” (resolved path is not the same as the config value; see $nu.history-path)
  • $env.config.plugins: {} — no default plugin settings
  • $env.config.abbreviations: {} — no default abbreviations

@github-actions

Copy link
Copy Markdown

Hey, just a bot checking in! You edited files related to the configuration.
If you changed any of the default values or added a new config option, don't forget to update the doc_config.nu which documents the options for our users including the defaults provided by the Rust implementation.
If you didn't make a change here, you can just ignore me.

@fdncred
fdncred merged commit dd358b7 into nushell:main Jul 28, 2026
15 checks passed
@fdncred
fdncred deleted the make_defaults_viewable branch July 28, 2026 11:36
@github-actions github-actions Bot added this to the v0.115.0 milestone Jul 28, 2026
@fdncred fdncred added notes:fixes Noted in "Bug fixes" section notes:ready Indicates Ready for Release notes labels Jul 28, 2026
Bahex pushed a commit that referenced this pull request Jul 31, 2026
## Description
This PR fixes and oversight in #18747 where color config fallbacks were
set to the Color::Default.

## User-facing changes (Release notes)
If you set part of the color config, the defaults for the other parts
will still be applied.
kronberger-droid added a commit to kronberger-droid/nushell that referenced this pull request Aug 13, 2026
Both entries claimed a full list replacement (`=`) clears the defaults.
It has not since nushell#18747 made them `Config::default()` values merged by
name, so `$env.config.keybindings = []` and `$env.config.menus = []` are
both no-ops. Dropped those two commented examples rather than document an
operation that does nothing.
fdncred pushed a commit that referenced this pull request Aug 13, 2026
## Description

#18761 swapped the wholesale `self.keybindings = keybindings` assignment
for a loop that merges each incoming binding into the existing list,
matching on `name`.
`name` is `Option<Value>` on `ParsedKeybinding`, so an unnamed binding
matches nothing and falls through to the `push`, every time.
Re-sourcing a config therefore grows the list by one entry per unnamed
binding on each pass.

The fix matches on the identity reedline already keys a binding by:
named bindings compare on the expanded `name`, unnamed ones on
`modifier`, `keycode` and `mode`, and a named/unnamed pair never
matches.

Also fixes `doc_config.nu`, which still claimed a full list replacement
(`=`) clears the defaults for `keybindings` and `menus`.
That was true when #18747 wrote it, but #18761 made both assignments
no-ops without updating the text, so I dropped the two commented
examples.

Worth landing before 0.115, since neither PR has shipped yet (last tag
is 0.114.1).

## User-facing changes (Release notes)

Assigning `$env.config.keybindings` or `$env.config.menus` now merges
into the defaults rather than replacing them, so
`$env.config.keybindings = []` and `$env.config.menus = []` no longer
clear anything.
Set `event: null` on a matching binding to unbind a key.

## Additional notes

The merge change rode in on #18761 alongside a large amount of unrelated
completer work, which is probably why the doc drift went unnoticed.

Out of scope: the merge still has no way to drop a binding outright.
kronberger-droid added a commit to kronberger-droid/nushell that referenced this pull request Nov 3, 2026
Since nushell#18761 assigning `$env.config.keybindings` merged into the
current list, thus no assignment could drop a single binding, and a
binding with a bad keycode errored on every prompt until the whole
list was cleared.

The list is now stored as written, like any other list: `=` replaces
it, `++=` appends and a filtered list drops what it filtered out.
Reedline applies the entries in order on top of its base maps, so the
last entry on a key wins, in each mode it names. A name is only a
label.

`= [mine]` now drops the default menu bindings as well, since nushell#18747
moved them into the list. Use `++=` to keep them.

`SharedKeybindingName` goes: one name on several keys (atuin) is no
longer ambiguous once nothing merges by name.
kronberger-droid added a commit to kronberger-droid/nushell that referenced this pull request Nov 3, 2026
Since nushell#18761 assigning `$env.config.keybindings` merged into the
current list, thus no assignment could drop a single binding, and a
binding with a bad keycode errored on every prompt until the whole
list was cleared.

The list is now stored as written, like any other list: `=` replaces
it, `++=` appends and a filtered list drops what it filtered out.
Reedline applies the entries in order on top of its base maps, so the
last entry on a key wins, in each mode it names. A name is only a
label.

`= [mine]` now drops the default menu bindings as well, since nushell#18747
moved them into the list. Use `++=` to keep them.

`SharedKeybindingName` goes: one name on several keys (atuin) is no
longer ambiguous once nothing merges by name.
kronberger-droid added a commit to kronberger-droid/nushell that referenced this pull request Nov 3, 2026
Since nushell#18761 assigning `$env.config.keybindings` merged into the
current list, thus no assignment could drop a single binding, and a
binding with a bad keycode errored on every prompt until the whole
list was cleared.

The list is now stored as written, like any other list: `=` replaces
it, `++=` appends and a filtered list drops what it filtered out.
Reedline applies the entries in order on top of its base maps, so the
last entry on a key wins, in each mode it names. A name is only a
label.

`= [mine]` now drops the default menu bindings as well, since nushell#18747
moved them into the list. Use `++=` to keep them.

`SharedKeybindingName` goes: one name on several keys (atuin) is no
longer ambiguous once nothing merges by name.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

notes:fixes Noted in "Bug fixes" section notes:ready Indicates Ready for Release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant