zsh-autosuggestions
zsh-autosuggestions copied to clipboard
parse error near `_ZSH_AUTOSUGGEST_ASY...'
Describe the bug
With a clean install using oh-my-zsh, I get this error:
~/.oh-my-zsh/custom/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh:769: parse error near `_ZSH_AUTOSUGGEST_ASY...'
it seems to be related to any lines containing a <&-. If I comment everything inside the _zsh_autosuggest_async_request function, the issue moves over to line 826 which is
exec {1}<&-
If I comment that line, then I no longer receive any warnings.
To Reproduce
Expected behavior
Should not show an error
Desktop
- macOS Monterey - M1 Pro
- Zsh version: 5.8
- Plugin version: a411ef3
Thanks @paul-vd. Are you able to reproduce this without oh-my-zsh? You can run zsh -df and then source the plugin manually with source ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
Sorry, I meant to edit my original post, yea it works without oh-my-zsh

Interesting. Can you confirm your zsh version with echo $ZSH_VERSION?
v5.8, also after reporting this issue I did a complete uninstall of oh-my-zsh and reinstall but still the same issue.
Thanks. Do you get an error running these in zsh -df?
% exec {fd}<<(echo foo)
% exec {fd}<&-
No I don't get an error running those.
~Hmm I just restarted my mac and the error seems to have disappeared and the autosuggestions now work. 🤷♂️~
Doing source ~/.zshrc brings the error back up
Ah interesting. This may be something caused by sourcing your zshrc more than once. That's not generally recommended. To reload config changes you make to your zshrc file, just restart zsh in a new terminal instance or run exec zsh instead of running source ~/.zshrc
Yea so I just completely removed oh-my-zsh, reinstalled it, and added the plugin, but it is still the same issue, I'm not sourcing .zshrc from anywhere else, so it is indeed strange.