Allow any keys to drive navigation - #11
Open
spenthil wants to merge 1 commit into
Open
Conversation
herdr side: the key forwarded into a Vim pane is now overridable per direction via HERDR_NAV_KEY_LEFT/DOWN/UP/RIGHT. The defaults are the previously hardcoded ctrl+h/j/k/l, so existing setups are unaffected. editor side (vim.vim + nvim.lua): the four maps now go through <Plug>(HerdrNavigateLeft/Down/Up/Right). g:herdr_nav_keys replaces any subset of the default keys, and an empty string drops that direction. g:herdr_nav_no_mappings=1 defines no keys at all, for binding the <Plug> mappings directly. README: new "Custom keys" section documenting the three hops that must agree, with a full ctrl+arrow example. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Motivation
Ctrl+h/j/k/lcosts real defaults in some setups: Neovim'sCtrl+lclear-and-redraw, and readline'sCtrl+l/Ctrl+kin shell panes (the README already calls this out). Some people also navigate with other chords entirely — I usectrl+arrow, matching my tmux bindings on servers. This PR makes every key configurable while changing no defaults.Changes
navigate.sh: the key forwarded into a Vim pane now readsHERDR_NAV_KEY_LEFT/DOWN/UP/RIGHTper direction, defaulting to the previously hardcodedctrl+h/j/k/l.editor/nvim.lua+editor/vim.vim: navigation is exposed as<Plug>(HerdrNavigateLeft/Down/Up/Right).g:herdr_nav_keysreplaces any subset of the default keys, and an empty string drops that direction.g:herdr_nav_no_mappings = 1defines no keys at all, so any binding can drive the<Plug>mappings directly.README.md: a "Custom keys" section documents the three hops that must agree (herdr keybind → forwarded key → editor map), with a completectrl+arrowexample. One over-long intro sentence is split; no other prose changes.Compatibility
With nothing set, behavior is identical: same keys, same forwarding. The one observable difference is that
:mapshows the default keys as<Plug>redirections instead of direct function calls.Testing
navigate.shagainst a live herdr 0.7.5 pane running Neovim: a probe mapping in that Neovim recorded the forwarded chord —ctrl+hwith nothing set, andctrl+upwithHERDR_NAV_KEY_UP='ctrl+up'.nvim --cleanmatrix: defaults, custom keys, a dropped direction, andno_mappings, checking the resulting maps withmaparg(). Afeedkeys()test confirms a custom chord moves between two real splits through the<Plug>chain.🤖 Generated with Claude Code