feat: persistent command layer (vim-like navigation mode) - #2777
feat: persistent command layer (vim-like navigation mode)#2777adrien-barret wants to merge 1 commit into
Conversation
Add a new Mode::FocusNav: a sticky navigation mode modeled on resize mode. Enter it via the configurable `focus_nav` keybind (unset by default) and it stays open so you can chain movements without re-pressing the prefix each time: h/j/k/l or arrows -> move pane focus Tab / Shift+Tab -> next / previous tab ] / [ -> next / previous workspace esc / enter -> exit Unlike the existing one-shot prefix actions and the navigator/goto pickers, focus stays in the mode until Escape, giving a vim-like modal navigation layer over panes, tabs, and workspaces.
|
Hi @adrien-barret, thanks for your interest in contributing. Herdr does not accept unsolicited implementation pull requests from contributors who are not listed in The pull request author is not an approved contributor. If you encountered a reproducible bug, report the observed behavior through the bug issue template. A report does not reserve the work or authorize a pull request; accepted fixes are normally implemented by Herdr’s maintainer-controlled agents. Feature requests, behavior changes, and other proposals belong in GitHub Discussions. Do not open an issue merely to justify an implementation that was already written. If a maintainer explicitly wants this implementation, they can reopen the pull request. Reopening by anyone else will be closed again automatically. See https://github.com/herdrdev/herdr/blob/master/CONTRIBUTING.md for the contribution policy. |
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (9)
📝 WalkthroughWalkthroughThe application adds a configurable ChangesFocus navigation
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant TerminalKey
participant Keybinds
participant NavigateAction
participant App
participant UI
TerminalKey->>Keybinds: resolve focus_nav
Keybinds->>NavigateAction: return EnterFocusNav
NavigateAction->>App: switch to Mode::FocusNav
TerminalKey->>App: send navigation key
App->>App: handle_focus_nav_key
App->>UI: render focus-navigation overlay
Possibly related PRs
Suggested labels: ✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment Warning |
|
@coderabbitai review |
|
What
Adds a persistent, vim-like command layer (
Mode::FocusNav) — a normal-modecounterpart to the terminal's insert mode. Enter it via a configurable
focus_navkeybind and the whole prefix keymap goes live on bare keys, staying open across
actions instead of exiting after one:
h/j/k/lfocus panes,cnew tab,v/-split,p/nswitch tabs,wworkspace picker,xclose,zzoom, and so on.A
CMDstatus bar is shown while the layer is active.Text dialogs suspend and return
Actions that open a text input (rename workspace/tab/pane, new-tab / new-workspace
name prompts, confirm-close) suspend the command layer so you can type. On
commit or cancel you return to the command layer — not to the terminal — so an
accidental rename never drops you out of navigation.
Why
Today, movement in the live layout is one-shot:
prefix+h/j/k/lmoves focus onceand returns to the terminal, and
goto/workspace_pickerare pickers that closeon selection. There is no sticky, modal layer to drive herdr with bare keys. This
adds a familiar normal/insert split over panes, tabs, and workspaces, reusing the
existing keymap so there is nothing new to learn.
Design
Mode::FocusNav;handle_focus_nav_keydispatches the same prefix keymap(
non_indexed_action_for_key/command_for_key/indexed_navigation_actionwith
BindingDispatch::Prefix) but never auto-exits.AppState.command_layerflag, set on entry and kept across dialogs. Theshared return helpers (
leave_navigate_mode,leave_command_mode,leave_modal,confirm_close_cancel) route back toMode::FocusNavwhile the flag is set — thisis what makes dialogs suspend-and-return.
EnterFocusNav, wired asfocus_nav, unset by default —no change to existing keymaps. Existing
Navigate/Navigatorbehavior isuntouched.
Config
Testing
nix build .#herdrpasses.herdr config checkacceptsfocus_navand still flags unknown keys.and confirm both commit and Escape return to the command layer; Escape from the
layer returns to the terminal.