From 2c9b52ded7e6f8b345a105a2166b5a080f80c3f6 Mon Sep 17 00:00:00 2001 From: kronberger-droid Date: Tue, 10 Nov 2026 11:51:49 +0100 Subject: [PATCH] docs(blog): lead with config default in the 0.117.0 keybindings notes The `(config default).keybindings` plus `++=` pattern only appeared in the later #19438 section, while the breaking section readers check first showed a bare `++=` that grows the list on every re-source. `config default` also replaces the `nu -n` round trip for restoring the defaults, thus the #19438 section now points back instead of repeating the pattern. --- blog/2026-11-09-nushell_v0_117_0.md | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/blog/2026-11-09-nushell_v0_117_0.md b/blog/2026-11-09-nushell_v0_117_0.md index e7fc45421bb..f05e2cf171c 100644 --- a/blog/2026-11-09-nushell_v0_117_0.md +++ b/blog/2026-11-09-nushell_v0_117_0.md @@ -180,15 +180,18 @@ Breaking: `$env.config.keybindings = [...]` and `$env.config.menus = [...]` now If your config assigns either list, or sets `keybindings` or `menus` inside a `$env.config = {...}` record, switch to `++=` or Tab stops completing. Reedline's own bindings (movement, editing) are not part of the list and stay. +Starting from the new `config default` command keeps the list stable when the config is sourced again, since a bare `++=` appends its entries each time: + ```nu +$env.config.keybindings = (config default).keybindings $env.config.keybindings ++= [{ name: my_binding, modifier: control, keycode: char_t, mode: emacs, event: { send: clearscreen } }] ``` -To get the defaults back in a running shell, assign them again from a clean `nu -n`: +To get the defaults back in a running shell, assign them again: ```nu -$env.config.keybindings = (^$nu.current-exe -n -c '$env.config.keybindings | to nuon' | from nuon) -$env.config.menus = (^$nu.current-exe -n -c '$env.config.menus | to nuon' | from nuon) +$env.config.keybindings = (config default).keybindings +$env.config.menus = (config default).menus ``` Filtering a list now removes what it drops, and `= []` clears either list. @@ -989,12 +992,7 @@ This also fixes alignment for multiline record keys, empty values with zero padd Assigning `$env.config.keybindings` or `$env.config.menus` now produces an error if an entry can't be read, leaving the old list unchanged. This validation covers a keybinding's `modifier`, `keycode` and `mode`, and a menu's `layout`, `input_mode` (or `only_buffer_difference`) and `output_mode`. Menus without a `layout`, such as `type: {}`, are also rejected. Previously, invalid entries were accepted and failed on every prompt. In `config.nu`, a rejected assignment stops the lines after it from running. -The new `config default` command returns the default configuration as a record. Since sourcing a config again appends its `++=` entries each time, while `=` replaces the list and drops the defaults, start from the defaults before adding custom entries to keep the list stable: - -```nu -$env.config.keybindings = (config default).keybindings -$env.config.keybindings ++= $custom -``` +This PR also adds `config default`, which returns the default configuration as a record. See the breaking change on assigning keybindings and menus above for how to build your list from it. ### More date formats and more reliable datetime parsing