fix(keymap): a keybinding in config adds a chord instead of replacing the default (#868)

effective_bindings kept one chord per action and set_binding overwrote that
slot, so "NextTab": "cmd-shift-]" silently took Ctrl+Tab away.

A string in keybindings now adds a chord beside the action's default (or
preset) chord; "" still unbinds, as configs and the docs already rely on; a
list is the exact chord set, [] unbinds. Configured chords are installed after
every shipped one, so a chord the user names wins a tie with another action's
default. The Settings page lists every chord of an action, and recording a
shortcut writes the list shape (it sets the binding) and takes only the stolen
chord from the action that had it.

Claude-Session: https://claude.ai/code/session_01JRqYZ9E153WpSHGS2AW3BM
This commit is contained in:
l0ng-ai
2026-09-14 21:48:19 +08:00
parent 37c2ef2176
commit 436ea04f33
6 changed files with 226 additions and 75 deletions
+15 -2
View File
@@ -39,13 +39,26 @@ the panel tabs. They are all in the command palette, and all bindable here.
```json
{
"keybindings": {
"SplitRight": "cmd-d",
"NextTab": "cmd-shift-]",
"SplitRight": ["cmd-d"],
"ResizePaneLeft": "ctrl-alt-left",
"ToggleSftp": "cmd-shift-u"
"ToggleFullscreen": ""
}
}
```
An action's value takes one of two shapes:
| Value | Means |
|---|---|
| `"cmd-shift-]"` | **Add** this shortcut. The default keeps working — <kbd>⌃ ⇥</kbd> still switches tabs |
| `["cmd-d"]` | **Replace**: exactly these shortcuts, nothing else. List several to have several |
| `""` or `[]` | **Unbind** the action |
Recording a shortcut on the Settings page replaces, so it writes the list
shape. A shortcut you add that another action already uses wins: it is the one
that runs.
The syntax is modifiers joined by `-`, then the key. Chords are separated by a
space.