Problem
The precmd hook zsh-clj-shell-install-widget re-installs the accept-line widget on every prompt. This conflicts with other plugins that also wrap accept-line, specifically zsh-syntax-highlighting and zsh-autosuggestions.
Symptoms
- "No such widget 'zsh-clj-shell-orig-accept-line'" flashes briefly on every prompt redraw (e.g. after
cd)
- If the
add-zsh-hook -d precmd zsh-clj-shell-install-widget workaround is removed, zsh: write error occurs instead
- Both issues stem from the widget chain between plugins getting into a broken state
Root cause
zsh-clj-shell-install-widget runs on every precmd and calls zle -A accept-line zsh-clj-shell-orig-accept-line, which saves whatever is currently bound to accept-line — including other plugins' wrappers. When those plugins also maintain their own accept-line wrappers, the chain becomes circular or breaks, causing the errors above.
Reproduction
In .zshrc, load these plugins (via oh-my-zsh or manually):
plugins=(... zsh-autosuggestions zsh-syntax-highlighting)
Then source zsh-clj-shell last:
source ~/.oh-my-zsh/custom/plugins/zsh-clj-shell/zsh-clj-shell.plugin.zsh
Run any command (e.g. cd) and observe the error flash.
Suggested fix
Instead of re-installing the widget on every precmd, install it once at source time and trust that it stays in place. If re-installation is needed, check whether the current accept-line is already zsh-clj-shell-accept-line before overwriting (the check exists in zsh-clj-shell-install-widget but the zle -A save still runs and clobbers the chain).
Alternatively, consider using zle -A .accept-line zsh-clj-shell-orig-accept-line (note the dot prefix) to save the builtin accept-line rather than whatever wrapper is currently on top.
Environment
- macOS (zsh 5.9)
- oh-my-zsh with zsh-autosuggestions and zsh-syntax-highlighting
- Starship prompt
Problem
The
precmdhookzsh-clj-shell-install-widgetre-installs theaccept-linewidget on every prompt. This conflicts with other plugins that also wrapaccept-line, specificallyzsh-syntax-highlightingandzsh-autosuggestions.Symptoms
cd)add-zsh-hook -d precmd zsh-clj-shell-install-widgetworkaround is removed,zsh: write erroroccurs insteadRoot cause
zsh-clj-shell-install-widgetruns on everyprecmdand callszle -A accept-line zsh-clj-shell-orig-accept-line, which saves whatever is currently bound toaccept-line— including other plugins' wrappers. When those plugins also maintain their ownaccept-linewrappers, the chain becomes circular or breaks, causing the errors above.Reproduction
In
.zshrc, load these plugins (via oh-my-zsh or manually):Then source zsh-clj-shell last:
Run any command (e.g.
cd) and observe the error flash.Suggested fix
Instead of re-installing the widget on every
precmd, install it once at source time and trust that it stays in place. If re-installation is needed, check whether the currentaccept-lineis alreadyzsh-clj-shell-accept-linebefore overwriting (the check exists inzsh-clj-shell-install-widgetbut thezle -Asave still runs and clobbers the chain).Alternatively, consider using
zle -A .accept-line zsh-clj-shell-orig-accept-line(note the dot prefix) to save the builtinaccept-linerather than whatever wrapper is currently on top.Environment