Make open-editor binding configurable via keymap#192
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR makes the “open external editor while entering an annotation” keybinding configurable through the existing keymap system (new open_editor action), removing the hardcoded Ctrl+E behavior that conflicts with common readline/emacs bindings.
Changes:
- Add
ActionOpenEditor/open_editorto the keymap with a defaultctrl+ebinding and help metadata. - Route annotation-input handling through keymap resolution (instead of hardcoded
tea.KeyCtrlE) and update placeholder text to reflect the currently bound key (or omit the hint when unbound). - Update documentation surfaces (README, HTML docs, plugin reference docs) to list
open_editorand clarify chord limitations during text input.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| site/docs.html | Documents open_editor, adds chord-in-text-input limitation note, updates available actions list. |
| README.md | Documents open_editor, chord limitation note, updates available actions list. |
| plugins/codex/skills/revdiff/references/usage.md | Mirrors README/docs updates for Codex plugin reference usage. |
| plugins/codex/skills/revdiff/references/config.md | Adds open_editor to action list and documents chord limitation in text input. |
| app/ui/handlers.go | Adjusts display formatting for ctrl+ key names (for help/placeholder display). |
| app/ui/handlers_test.go | Adds coverage for displayKeyName formatting behavior (including chords). |
| app/ui/annotate.go | Uses keymap-driven open_editor dispatch during annotation input and dynamic placeholders. |
| app/ui/annotate_test.go | Adds tests for remapped/unbound editor binding behavior and placeholder rendering. |
| app/keymap/keymap.go | Adds ActionOpenEditor, default binding, and help entry. |
| app/keymap/keymap_test.go | Adds tests validating open_editor action validity, default binding, and help entry. |
| .claude-plugin/skills/revdiff/references/usage.md | Mirrors README/docs updates for Claude plugin reference usage. |
| .claude-plugin/skills/revdiff/references/config.md | Adds open_editor to action list and documents chord limitation in text input. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| keys := m.keymap.KeysFor(keymap.ActionOpenEditor) | ||
| var single []string | ||
| for _, k := range keys { | ||
| if !strings.Contains(k, ">") { |
| Available actions: `down`, `up`, `page_down`, `page_up`, `half_page_down`, `half_page_up`, `home`, `end`, `scroll_left`, `scroll_right`, `scroll_center`, `scroll_top`, `scroll_bottom`, `next_item`, `prev_item`, `next_hunk`, `prev_hunk`, `toggle_pane`, `focus_tree`, `focus_diff`, `search`, `confirm`, `annotate_file`, `delete_annotation`, `annot_list`, `open_editor`, `toggle_collapsed`, `toggle_compact`, `toggle_wrap`, `toggle_tree`, `toggle_line_numbers`, `toggle_blame`, `toggle_hunk`, `toggle_untracked`, `mark_reviewed`, `theme_select`, `filter`, `info`, `quit`, `discard_quit`, `help`, `dismiss` | ||
|
|
||
| Modal keys (annotation input, search input, confirm discard) are not remappable. | ||
| Modal keys (annotation input, search input, confirm discard) are not remappable. Chord bindings do not fire during text input — use single-key `ctrl+*` bindings for actions like `open_editor` that need to work during annotation input. |
| Available actions: `down`, `up`, `page_down`, `page_up`, `half_page_down`, `half_page_up`, `home`, `end`, `scroll_left`, `scroll_right`, `scroll_center`, `scroll_top`, `scroll_bottom`, `next_item`, `prev_item`, `next_hunk`, `prev_hunk`, `toggle_pane`, `focus_tree`, `focus_diff`, `search`, `confirm`, `annotate_file`, `delete_annotation`, `annot_list`, `open_editor`, `toggle_collapsed`, `toggle_compact`, `toggle_wrap`, `toggle_tree`, `toggle_line_numbers`, `toggle_blame`, `toggle_hunk`, `toggle_untracked`, `mark_reviewed`, `theme_select`, `filter`, `info`, `quit`, `discard_quit`, `help`, `dismiss` | ||
|
|
||
| Modal keys (annotation input, search input, confirm discard) are not remappable. | ||
| Modal keys (annotation input, search input, confirm discard) are not remappable. Chord bindings do not fire during text input — use single-key `ctrl+*` bindings for actions like `open_editor` that need to work during annotation input. |
| <div class="code-block"><code>map ctrl+w>x mark_reviewed | ||
| map alt+t>n theme_select</code></div> | ||
| <p>When the leader is pressed, the status bar shows <code>Pending: ctrl+w, esc to cancel</code>; press the second key to dispatch, or <code>esc</code> to cancel silently. Binding a key as both a standalone action and a chord prefix drops the standalone binding (the chord wins, with a warning). Chord bindings work under non-Latin keyboard layouts — the second-stage key is translated via the same layout-resolve fallback as single-key bindings.</p> | ||
| <p>When the leader is pressed, the status bar shows <code>Pending: ctrl+w, esc to cancel</code>; press the second key to dispatch, or <code>esc</code> to cancel silently. Binding a key as both a standalone action and a chord prefix drops the standalone binding (the chord wins, with a warning). Chord bindings work under non-Latin keyboard layouts — the second-stage key is translated via the same layout-resolve fallback as single-key bindings. Note: chord bindings do not fire during text input (annotation and search prompts) — use single-key <code>ctrl+*</code> bindings for actions like <code>open_editor</code> that need to work during annotation input.</p> |
| ``` | ||
|
|
||
| When the leader is pressed, the status bar shows `Pending: ctrl+w, esc to cancel`; press the second key to dispatch, or `esc` to cancel silently. Binding a key as both a standalone action and a chord prefix drops the standalone binding (the chord wins, with a warning). Chord bindings work under non-Latin keyboard layouts — the second-stage key is translated via the same layout-resolve fallback as single-key bindings. | ||
| When the leader is pressed, the status bar shows `Pending: ctrl+w, esc to cancel`; press the second key to dispatch, or `esc` to cancel silently. Binding a key as both a standalone action and a chord prefix drops the standalone binding (the chord wins, with a warning). Chord bindings work under non-Latin keyboard layouts — the second-stage key is translated via the same layout-resolve fallback as single-key bindings. Note: chord bindings do not fire during text input (annotation and search prompts) — the leader key is consumed by the text input widget. Use single-key `ctrl+*` bindings for actions like `open_editor` that need to work during annotation input. |
route the Ctrl+E editor key in annotation mode through the keymap system as the open_editor action so users can remap it via keybindings file. - add ActionOpenEditor to keymap with ctrl+e default binding - handleAnnotateKey resolves through keymap instead of hardcoded tea.KeyCtrlE - placeholder text dynamically reflects the bound key, omits hint when unbound - filter chord bindings from placeholder (chords do not fire during text input) - displayKeyName uppercases only first char after ctrl+ to preserve chord case - add open_editor to available-actions lists across all doc surfaces - document chord limitation during modal text input - add tests for remapped/unbound editor key, displayKeyName, action validity
0630be4 to
5c3a18c
Compare
Deploying revdiff with
|
| Latest commit: |
5c3a18c
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://2680c110.revdiff.pages.dev |
| Branch Preview URL: | https://feat-open-editor-keymap.revdiff.pages.dev |
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.
the
Ctrl+Ekey that opens$EDITORduring annotation input was hardcoded, conflicting with the standard readline/emacs end-of-line binding. This routes it through the keymap system as theopen_editoraction so users can remap it via~/.config/revdiff/keybindings.what changed:
ActionOpenEditoradded to keymap withctrl+edefault bindinghandleAnnotateKeyresolves through keymap instead of hardcodedtea.KeyCtrlEdisplayKeyNameuppercases only first char afterctrl+to preserve chord caseopen_editoradded to available-actions lists across all doc surfacesto remap:
Addresses #190