feat: add configurable keymaps for all views via opts.keymaps - #151
Open
ldhnam wants to merge 2 commits into
Open
feat: add configurable keymaps for all views via opts.keymaps#151ldhnam wants to merge 2 commits into
ldhnam wants to merge 2 commits into
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.
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
Introduce a central keymap registry (
lua/fugit2/view/keymaps.lua) as the single source of truth for default bindings across all views. Every keymap in every view is now configurable viaopts.keymaps.<group>.<action>.Changes
lua/fugit2/view/keymaps.luawith defaults for 17 view 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,patchbind/bind_buf/resolve_keysfor binding views and raw buffersopts.keymapsaccepts a single key, a list,false(disable), or""(no-op)file_tree_maps.menuis translated intokeymaps.file_tree.menu_<action>;file_tree_maps.directhandling preserveddocs/keymap-remapping.mdwith full defaults tables; linked from READMEkeymaps_spec.lua(registry/merge/conflict) +config_spec.lua(legacy translation); full suite 205 passingExample
Note
This resolves the README TODO "Allow remap default key binding".