fix(shell-plugin): add vi-command mode bindings for zsh-vi-mode compatibility#2684
fix(shell-plugin): add vi-command mode bindings for zsh-vi-mode compatibility#2684i010542 wants to merge 1 commit intoantinomyhq:mainfrom
Conversation
…tibility When the zsh-vi-mode plugin (jeffreytse/zsh-vi-mode) is active, the Enter key in vi-command mode does not trigger forge's colon commands. Users report 'command not found: :model' and similar errors. Root cause: bindkey '^M' only sets the binding in the current keymap. In vicmd mode, Enter is bound to vi-accept-line, not forge-accept-line. Fix: also bind Enter and Tab in vicmd mode when zsh-vi-mode is detected. Detection uses $ZVM_MODE (zsh-vi-mode plugin) or bindkey -lL main (native vi mode via bindkey -v). Fixes: antinomyhq#2681 Co-Authored-By: ForgeCode <noreply@forgecode.dev>
|
Hi @tusharmath — PR #2684 ready for review! Fixes issue #2681: zsh-vi-mode compatibility for forge colon commands. What changed: now also binds Enter and Tab in vicmd mode when zsh-vi-mode is detected. Root cause: "^M" accept-line only sets the binding in the current keymap. In vicmd mode, Enter was bound to vi-accept-line, bypassing forge-accept-line entirely. Test: Load zsh-vi-mode in ~/.zshrc, type :model, press Enter — should work now. Happy to refine based on your feedback! 🙏 |
|
|
|
Can u add a screenrecording of before vs after your fix. |
Problem Summary
When the zsh-vi-mode plugin (from Oh-My-Zsh) is active, none of the forge colon commands work (e.g.,
:model,:info,:doctor). Users reportzsh: command not found: :modeleven thoughforge zsh doctorreports all checks passing.Root Cause
shell-plugin/lib/bindings.zshsetsbindkey '^M' forge-accept-line, but this only binds in the current keymap. In vi-command mode (vicmd), Enter is bound tovi-accept-line, notforge-accept-line. Since forge's colon-command detection lives entirely inforge-accept-line, commands are silently discarded.Solution
Detect zsh-vi-mode (via
$ZVM_MODEvariable orbindkey -lL maininspection) and also bind Enter and Tab in vicmd mode to forge's widgets:This is non-breaking: the check only activates when vi mode is detected.
Test Evidence
~/.zshrc::modeland press Enter → should invokeforge-accept-lineforge-completionKey Differentiator
Unlike a generic "add vi mode support" patch, this specifically targets the zsh-vi-mode plugin's keymap isolation — a narrow, well-scoped fix for the reported bug.
Resolves: #2681