Repository navigation
feat(keys): rebind every key under [keys] - #104
Open
benjaminwood wants to merge 1 commit into
Open
benjaminwood wants to merge 1 commit into
benjaminwood wants to merge 1 commit into
Conversation
Each key the viewer acts on is now an action with a name (`down`, `line-start`, `send`, ...) and a list of keys in config.toml, defaulting to today's bindings. A key bound to two actions that read the same keypress is a config error that names both, and the footer, menu and toolbar hints follow the bindings. Refs plannotator#58 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01B4DEckuRs9pSTyzuvCvrXN
This was referenced Oct 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements the keys half of #58, to the shape described there.
[keys]in config.toml: action name to a list of keys. An entry replaces that action's keys;[]unbinds it. Every other action keeps its default.key "j" is bound to both down and leftunknown variantlefty, expected one ofup,down, …unknown key "Lft"; expected one character, ctrl+<character>, or one of Up, Down, …plannotator-tui configprints every action with its keys.Shape
src/keys.rs:Action(kebab-case names),Key(a character, a named key, orctrl+<character>),Keymap, and one context per mode (GLOBAL,DOCUMENT,MOTION,TREE,MENU, …) listing the actions it dispatches in the order it tries them. Call sites read as before:match self.keys.action(&key, keys::TREE) { Some(Action::Down) => … }.downonce covers the document, tree, notes, menu and pickers.Homeistopamong blocks andline-startfor the cursor.input.rs,menu.rs,pick.rsandarchive_view.rs; all four go through the keymap now. The compose box (text entry) is untouched.For review
ctrl+…needs Ctrl alone.ctrl+cis its own action,interrupt, so rebindingquitcan't lose it. Each mode closes on exactly the keys it did before (e.g.qstill doesn't close the Review menu).xon a note (remove, alsoDelete) andxon a block (clear-block) are separate actions, soDeletestays notes-only as today.[ui] themedoes, andplannotator-tui configreports the error.↑↓ … enter … esc) still name arrows and fixed keys; happy to make those follow too if you'd like.Testing:
cargo test --workspace(326 pass; newkeys::testsand an app test wherejkl;moves and the footer readsjkl; move),cargo clippy --workspace --all-targetsclean,cargo fmt --all --check. Run by hand with thejkl;layout above.🤖 Generated with Claude Code