feat: add keymap help menu with ? in every view - #152
Open
ldhnam wants to merge 4 commits into
Open
Conversation
Introduce a central keymap registry (lua/fugit2/view/keymaps.lua) as the single source of truth for default bindings across all views. Every view now binds its keymaps through keymaps.bind/bind_buf, and users can remap, disable (false) or no-op () any binding via opts.keymaps.<group>.<action>. Groups: file_tree, commit_log, patch_unstaged, patch_staged, rebase, graph_log, graph_branch, graph_select, diff, stash_list, pick, input, confirm, blame, blame_file, blame_popup, patch. Backward compatibility: the deprecated file_tree_maps.menu option is translated into keymaps.file_tree.menu_<action> in config.merge; the legacy file_tree_maps.direct handling is preserved. Adds keymaps_spec and config_spec covering defaults, overrides, disable, no-op, mode handling and legacy translation. 205 tests pass.
Document the opts.keymaps configuration surface: the per-view groups, default keybindings, disable/no-op semantics, and backward compatibility with the deprecated file_tree_maps.menu. Link it from the README and drop the stale docs/feature reference in the keymap registry comment.
Add a HelpView popup component (lua/fugit2/view/components/help_view.lua) that renders a view group's keybindings from the keymap registry. Press ? in any help-capable view (file tree, commit log, patch views, rebase, graph log/branch, diff, stash list) to see the effective bindings with descriptions, reflecting user opts.keymaps overrides. The ? binding is registered as the 'help' action in each view group, so it is remappable/disableable like any other key. Adds keymaps.help_entries() resolver (sorted by desc, multi-keys joined, disabled omitted) and the Fugit2HelpKey highlight group. Adds help_view_spec (line building, key padding, safe close) and help_entries specs. 218 tests pass. Resolves the README TODO 'Proper help menu'.
The HelpView popup used NUI's default zindex (50), identical to the status window's file tree. The help popup and its separate border window stacked at/behind the status window level, hiding the border. Set zindex to 55, matching the confirm popup, so the help menu always renders on top.
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.
Summary
Add a discoverable keymap help popup. Press
?in any view to see the effective keybindings with descriptions, pulled from the keymap registry introduced in the keymap-remapping PR (#151).Changes
HelpViewcomponentlua/fugit2/view/components/help_view.lua— a pure-read NUI popup modeled onstash_list_view, with padded key column,<disabled>placeholder for no-op bindings, andq/<Esc>/?close.?bound in every view: file tree, commit log, patch views (unstaged/staged), rebase, graph log/branch, diff, stash list.?binding is registered as thehelpaction in each view group, so it is remappable/disableable viaopts.keymapslike any other key.keymaps.help_entries()resolver — appliesopts.keymapsoverrides, joins multi-keys with/, omits disabled actions, sorts by description.Fugit2HelpKeyhighlight group.docs/help-menu.md; README feature list updated (resolves the TODO "Proper help menu").help_view_spec.lua(line building, key padding, safe close) +help_entriesspecs; full suite 218 passing.Example
Remap or disable it per view:
Dependencies
feat/keymap-remapping(feat: add configurable keymaps for all views via opts.keymaps #151). This PR branches off that work.