Skip to content

feat(keymap,proxy): Alt+H global keybindings cheat-sheet#67

Merged
fentas merged 2 commits into
masterfrom
feat/module-bindings-help
May 17, 2026
Merged

feat(keymap,proxy): Alt+H global keybindings cheat-sheet#67
fentas merged 2 commits into
masterfrom
feat/module-bindings-help

Conversation

@fentas
Copy link
Copy Markdown
Owner

@fentas fentas commented May 17, 2026

Summary

Alt+H now opens a one-screen cheat-sheet of every annotated keybinding — pulled from config.keymap.bindings, scrolled into shell history (like the LLM conclusion banner) so it stays available in scrollback.

Adds two optional fields to keymap.Binding:

  • label: []const u8 = "" — display name (e.g. "Alt+C")
  • description: []const u8 = "" — one-line action explanation

Bindings with EITHER field empty are hidden from help. Dual-encoded sibling bindings (legacy + kitty-kbd for the same chord) leave the second blank — the renderer deduplicates by enum index so each action shows once.

Alt+H reuses the existing llm_exec_toggle_help binding with a fall-through: when the LLM module returns "not consumed" (user isn't in AI mode), the proxy renders the global cheat-sheet instead. So Alt+H is useful in BOTH contexts — AI hint when typing #: …, full cheat-sheet otherwise.

Annotated bindings

Right, Ctrl+Right, Ctrl+Shift+I, Ctrl+Shift+D, Alt+A, Alt+S, Alt+Shift+S, Alt+M, Alt+H, Alt+C, Alt+Shift+C, Ctrl+Shift+X.

Follow-up (not this PR)

The user's original request was for modules to register their own bindings, with help auto-listing them. This PR adds the Binding.label / description infrastructure that supports that. Wiring the comptime walker (each module exposes pub const default_bindings: []const Binding = &.{...} and the dispatcher concats them) is a follow-up that doesn't change existing behaviour — it just moves the source-of-truth from defaults.zig into the modules. Filed as a follow-up.

Test plan

  • zig build test — 472/472 pass (includes new Binding label/description defaults test)
  • zig fmt --check — clean
  • Manual: press Alt+H outside AI mode → cheat-sheet scrolls into history
  • Manual: press Alt+H while typing #: … → existing LLM hint still surfaces

🤖 Generated with Claude Code

fentas and others added 2 commits May 17, 2026 11:53
Adds two optional fields to `keymap.Binding` — `label` (display name)
and `description` (one-line action explanation). The new
`renderHelp()` walker dumps all annotated bindings into shell history
as a dim-chrome banner with cyan keys + dim descriptions, matching
the LLM conclusion-banner palette.

`Alt+H` reuses the existing `llm_exec_toggle_help` binding with a
fall-through: when the LLM module returns "not consumed" (user isn't
in AI mode), the proxy renders the global cheat-sheet instead. So
Alt+H is now useful regardless of mode — AI hint when typing `#: …`,
keybindings cheat-sheet otherwise.

Dual-encoded sibling bindings (legacy + kitty-kbd CSI-u for the same
chord) leave the SECOND entry with empty label, so the help renderer
deduplicates by enum index — only the first non-empty annotation per
action is shown.

Annotated the shipped default bindings: Right, Ctrl+Right,
Ctrl+Shift+I, Ctrl+Shift+D, Alt+A, Alt+S, Alt+Shift+S, Alt+M, Alt+H,
Alt+C, Alt+Shift+C, Ctrl+Shift+X. User configs that supply their own
`bindings: []const Binding` keep working — both new fields default
to `""` (no help entry).

Follow-up work (out of scope for this PR): modules registering their
OWN `default_bindings` array via a comptime hook + dispatcher walker.
The foundation here (Binding.label/description) supports that
extension; just need to wire the walker.

`zig build test` (472 pass) + `zig fmt --check` clean.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@fentas fentas merged commit 45bd3e1 into master May 17, 2026
3 checks passed
@fentas fentas deleted the feat/module-bindings-help branch May 17, 2026 10:15
@github-actions github-actions Bot mentioned this pull request May 19, 2026
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