Fix Ctrl+hjkl navigation for herdr 0.7.0#2
Open
vlcinsky wants to merge 4 commits into
Open
Conversation
- Fix pane ID format: use public_pane_numbers to generate correct IDs (wB:p3 format) instead of deprecated wB-1 format - Add focus_pane_direction() using new pane.focus_direction API (herdr 0.7.0+) - Update focus_adjacent() to try new API first, fall back to computed approach for backward compatibility with older herdr versions Fixes devxplay#1
When HERDR_ACTIVE_PANE_ID or HERDR_PANE_ID are not set in the environment, query herdr's pane.current API to get the current pane ID instead of returning nil. This ensures pane registration works even when herdr doesn't inject the environment variables.
Herdr 0.7.0 (#613) added support for key-combo strings like 'ctrl+h' in pane.send_keys. Switch from pane.send_text with raw control bytes to pane.send_keys with key-combo strings for better compatibility and to avoid keyboard protocol re-encoding issues.
Document the keybinding conflict with LazyVim and similar distributions that set Ctrl+h/j/k/l after plugin setup. Provide a working configuration that ensures herdr.nvim keymaps take precedence by setting them after VimEnter with a delay.
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
Fixes Ctrl+hjkl navigation for herdr 0.7.0, addressing the incompatibilities described in issue #1.
Problems Fixed
1. Pane ID format incompatibility
{workspace_id}-{index+1}(e.g.,w3-1), but herdr 0.7.0 uses{workspace_id}:p{number}format (e.g.,w3:p3)public_pane_numbersfromsession.jsonto generate correct public pane IDs in the new format2. Focus API changed in 0.7.0
report_agent→agent.focus→release_agent) no longer moves focus in herdr 0.7.0pane.focus_directionRPC API added in herdr 0.7.03. Key forwarding method changed in 0.7.0
pane.send_textwith raw control bytes caused keyboard protocol re-encoding issuespane.send_keyswith key-combo strings ("ctrl+h", etc.) introduced in herdr 0.7.0 PR #6134. Environment variable fallback
HERDR_ACTIVE_PANE_IDenvironment variable which herdr doesn't inject automatically in all casesherdr pane currentAPI as fallback when environment variables are not set5. LazyVim/distro keybinding conflicts
Changes
Rust Binary (
src/main.rs)pane_public_mapping(): Now usespublic_pane_numbersto build correct{workspace}:p{n}IDsfocus_pane_direction(): New function usingpane.focus_directionAPI (herdr 0.7.0+)focus_adjacent(): Tries new API first, falls back to computed approach for compatibilitysend_ctrl_to_pane(): Switched frompane.send_textwith raw bytes topane.send_keyswith key-combo stringsLua Plugin (
lua/herdr/navigator.lua)pane_id(): Added fallback to queryherdr pane currentAPI when env vars are missingDocumentation (
README.md)Testing
Tested locally with herdr 0.7.0 on macOS:
Binary navigation:
herdr-navigator focus left/right/up/down- exit code 0herdr-navigator dispatch- correctly detects Neovim panes and forwards keysFull integration:
Compatibility
Closes #1