Skip to content

Semantic keymap: validated remapping, conflicts and host notes (#335) - #378

Draft
raiseCatError wants to merge 2 commits into
feature/workspace-foundationfrom
feature/semantic-keymap
Draft

raiseCatError wants to merge 2 commits into
feature/workspace-foundationfrom
feature/semantic-keymap

Conversation

@raiseCatError

Copy link
Copy Markdown
Owner

#335, stacked on the workspace foundation (#375). Standalone; independent of the sidebar (#376) and panel PRs.

A keymap is declarative data (bind/unbind by key name, context and action), validated before use, never executed:

  • Only keys NMSh's input parser tells apart are bindable; Ctrl+B, Cmd+K, Alt+Left and the like are refused with the reason (the terminal may send them as something else or not at all).
  • Job control (Ctrl+C/D/Z), paste, pointer and focus events are never bindable; in the composer neither are typing and Enter.
  • Every bindable key already means something in an empty composer (Left opens Sessions — TerminalApp.ts:2052 —, Right accepts the inline suggestion, Up recalls history, Tab completes, Shift+Tab moves through blocks…); a composer binding needs "replaces": true, and an active draft still wins.
  • Conflicts keep the first binding; invalid entries are skipped and reported while the defaults stand; an action left with no key and no command, or a sidebar with no way back, is reported.
  • hostNotes: Terminal.app's own Page Up/Down and Home/End scrolling, F1 on macOS, a tmux root-table (bind -n) binding, tmux's escape-time. Notes, never delivery guarantees; slash commands remain the reliable path.
  • describeKeymap: the bindings in effect plus the commands that always work.

Integration (later, with the frontend): keymap.json in the config directory, /keys and /keys reload.

Tests: tests/workspaceKeymap.test.ts. Design: docs/design/workspace-keymap.md. Physical checks of host delivery (Ghostty, Terminal.app, tmux) are listed, not performed.

#335, stacked on the workspace foundation. A keymap is declarative data
(bind/unbind entries by key name, context and action), validated before use
and never executed.

- Only keys the input parser tells apart are bindable; others (Ctrl+B,
  Cmd+K, Alt+Left) are refused with the reason.
- Job control, paste and pointer events are never bindable; in the
  composer neither are typing and Enter.
- Every bindable key already means something in an empty composer (Left
  opens Sessions, Right accepts the inline suggestion...), recorded from the
  composer's dispatch; a composer binding needs "replaces": true, and an
  active draft still wins.
- Conflicts keep the first binding; invalid entries are skipped and
  reported while the defaults stand; an action left with no key and no
  command, or a sidebar with no way back, is reported.
- hostNotes: Terminal.app's own Page Up/Down and Home/End scrolling, F1 on
  macOS, a tmux root-table binding, tmux's escape-time.
- describeKeymap lists the bindings in effect and the commands that always
  work.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant