fix(shell-plugin): add vi-command mode bindings for zsh-vi-mode compatibility#2684
Open
i010542 wants to merge 1 commit intoantinomyhq:mainfrom
Open
fix(shell-plugin): add vi-command mode bindings for zsh-vi-mode compatibility#2684i010542 wants to merge 1 commit intoantinomyhq:mainfrom
i010542 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>
Author
|
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! 🙏 |
|
|
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.
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