Skip to content

0.115 keybinding merge-by-name silently drops bindings that share a name across different keys (breaks atuin's ctrl-r) #18848

Closed

Description

@motillawy

Describe the bug

Since 0.115, assigning $env.config.keybindings merges into the existing list, matching named bindings on name alone (#18761, refined by #18828). A named binding therefore silently replaces an earlier binding with the same name even when it binds a different key.

This breaks atuin's generated init.nu in the wild: it appends two keybindings both named atuin — ctrl-r (search) and up-arrow — so the up-arrow entry replaces the ctrl-r one and ctrl-r silently falls back to the built-in history_menu. Reported on the atuin side as atuinsh/atuin#3929 (they can fix it by using distinct names), but the nushell-side semantics seem worth a look too: reedline keys bindings by (mode, modifier, keycode), and any config that reuses a name across keys — which was perfectly fine before 0.115 — now silently loses bindings.

How to reproduce

$env.config.keybindings = ($env.config.keybindings | append {name: atuin, modifier: control, keycode: char_r, mode: [emacs], event: {send: clearscreen}})
$env.config.keybindings = ($env.config.keybindings | append {name: atuin, modifier: none, keycode: up, mode: [emacs], event: {send: clearscreen}})
$env.config.keybindings | where name == atuin | select name modifier keycode

Expected behavior

Both bindings registered (pre-0.115 behavior), or at least a warning when a merge replaces a binding that targets a different key.

Actual behavior

╭───┬───────┬──────────┬─────────╮
│ # │ name  │ modifier │ keycode │
├───┼───────┼──────────┼─────────┤
│ 0 │ atuin │ none     │ up      │
╰───┴───────┴──────────┴─────────╯

The ctrl-r binding is gone; ctrl-r resolves to the default history_menu.

Suggested direction

Match named bindings on name and the key identity (mode, modifier, keycode) — mirroring how #18828 already matches unnamed ones — so a name reused across keys adds a binding instead of replacing one. If name-only matching is the intended contract, a warning on cross-key replacement (and a release-notes callout, since shell integrations like atuin generate duplicate-named bindings) would make the failure visible instead of silent.

Configuration

key value
version 0.115.0
os macOS (Darwin 25.5.0)
shell integration atuin 18.19.0 (atuin init nu)

Activity

  1. kronberger-droid commented on Aug 17, 2026

    @kronberger-droid
    Contributor

    This one was silently introduced by the completions PR. I tried to fix some things in there before the release, but this one i might not have caught.
    I will take a look at it.

  2. fdncred commented on Aug 18, 2026

    @fdncred
    Contributor

    I thought the entire point of the name was to have a unique name for the keybinding. I'm not sure we ever intended to have multiple keybindings with the same name in a fallback scenario. Seems to me like we should just warn users of duplicate naming but maybe I'm wrong? Let me know. But I'm up for whatever the best change is either way.

  3. kronberger-droid commented on Aug 18, 2026

    @kronberger-droid
    Contributor

    I think the best solution is to warn once and merge and rename one of them.
    But then if both are defined through config this won't work, i guess.

  4. added this to the v0.116.0 milestone on Aug 21, 2026
  5. modified the milestones: v0.116.0, v0.115.1 on Aug 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions