Skip to content

feat: add keymap help menu with ? in every view - #152

Open
ldhnam wants to merge 4 commits into
SuperBo:mainfrom
ldhnam:feat/help-menu
Open

feat: add keymap help menu with ? in every view#152
ldhnam wants to merge 4 commits into
SuperBo:mainfrom
ldhnam:feat/help-menu

Conversation

@ldhnam

@ldhnam ldhnam commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

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

  • New HelpView component lua/fugit2/view/components/help_view.lua — a pure-read NUI popup modeled on stash_list_view, with padded key column, <disabled> placeholder for no-op bindings, and q/<Esc>/? close.
  • ? bound in every view: file tree, commit log, patch views (unstaged/staged), rebase, graph log/branch, diff, stash list.
  • Registry integration: the ? binding is registered as the help action in each view group, so it is remappable/disableable via opts.keymaps like any other key.
  • keymaps.help_entries() resolver — applies opts.keymaps overrides, joins multi-keys with /, omits disabled actions, sorts by description.
  • Fugit2HelpKey highlight group.
  • Docs: docs/help-menu.md; README feature list updated (resolves the TODO "Proper help menu").
  • Tests: help_view_spec.lua (line building, key padding, safe close) + help_entries specs; full suite 218 passing.

Example

? keypress in file tree
  -> HelpView popup listing effective bindings, e.g.
       D / x    Discard changes
       s        Stage file
       u        Unstage file

Remap or disable it per view:

opts = {
  keymaps = {
    file_tree = { help = "H" },
    rebase = { help = false },
  },
}

Dependencies

ldhnam added 4 commits August 9, 2026 16:34
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.
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