Repository navigation
Add g? key help and describe every mapping - #24
Merged
Merged
Conversation
Every DiffBandit mapping now carries a "DiffBandit: ..." description and a help section (util/keyhelp), so :map, which-key, and keymap pickers explain them. g? (navigation.help_key) opens a floating list of the current window's keys, read from its live mappings so remaps and disabled keys show as they are. It is grouped by purpose and explains the compact diff header and the panel's staged symbols. Headers show a "g? help" hint (diff, merge, folder diff, commit panel, git log), the commit message label shows ":w commit" and the amend key, and the read-only review hint line is built from the configured keys instead of a hardcoded string. Fixes #21
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.
Fixes #21.
Stacked on #23 (it builds on
q,gzp, andclose_key). Merge #23 first; this PR then retargets tomain.What changes for users
g?in every DiffBandit window opens a floating list of that window's keys, grouped by purpose: General, Navigation, Hunks, Files, Staging and actions, Merge, Layout, Panel, Commit, Folder, Log. Keys that do the same thing share a row (<CR>, o).q,<Esc>, org?closes it, and so does leaving the window.all/unstg/stg,2/6,h3/5,M A D R ??,1/5.:w.:DiffBanditCloseand:help diffbandit.g? helpappears at the right of the diff, merge, and folder headers, on the panel's first row, and in the git log header. The commit label now readsCommit message: :w commit <Space> amend. When a header is too narrow, the hint is dropped and the path stays.DiffBandit: Next hunk), so which-key,:map, and keymap pickers can explain it.navigation.help_key = "g?". Set it tofalseto remove both the key and the hints.Implementation
lua/diffbandit/util/keyhelp.luadoes the work:opts()describes a mapping and files it under a section.sections()reads the live mappings.open()draws the window.hint()andplace_hint()draw the header hints.Tests
tests/specs/27_keyhelp.luacovers:<Space>and<display.help_key = false.It also fails if any mapping in a diff, panel, or merge buffer has no description, so a new key can't silently go missing from
g?.The full suite passes (
nvim --headless -u tests/run.lua).