zsh-autosuggestions icon indicating copy to clipboard operation
zsh-autosuggestions copied to clipboard

parse error near `_ZSH_AUTOSUGGEST_ASY...'

Open paul-vd opened this issue 3 years ago • 8 comments

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

  1. Install oh-my-zsh (on mac m1 pro).
  2. Clone oh-my-zsh.
  3. Launch a terminal.

Expected behavior

Should not show an error

Desktop

  • macOS Monterey - M1 Pro
  • Zsh version: 5.8
  • Plugin version: a411ef3

paul-vd avatar Jan 13 '22 11:01 paul-vd

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

ericfreese avatar Jan 13 '22 16:01 ericfreese

Sorry, I meant to edit my original post, yea it works without oh-my-zsh

image

paul-vd avatar Jan 13 '22 16:01 paul-vd

Interesting. Can you confirm your zsh version with echo $ZSH_VERSION?

ericfreese avatar Jan 13 '22 16:01 ericfreese

v5.8, also after reporting this issue I did a complete uninstall of oh-my-zsh and reinstall but still the same issue.

paul-vd avatar Jan 13 '22 16:01 paul-vd

Thanks. Do you get an error running these in zsh -df?

% exec {fd}<<(echo foo)
% exec {fd}<&-

ericfreese avatar Jan 13 '22 16:01 ericfreese

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

paul-vd avatar Jan 14 '22 07:01 paul-vd

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

ericfreese avatar Jan 15 '22 16:01 ericfreese

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.

paul-vd avatar Apr 03 '22 17:04 paul-vd