-
Notifications
You must be signed in to change notification settings - Fork 280
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Any plugin or script using bashcompinit & complete to define completion won't work after sourcing antigen #736
Comments
So maybe using some Zsh specific magic: $ A=("Foo Bar" Qux)
$ B=${(@qq)A}
$ printf "%s\n" ${(Q)${(z)B}}
Foo Bar
Qux |
Using some obscure Zsh syntax, check https://zsh.sourceforge.io/Doc/Release/Expansion.html#Parameter-Expansion-Flags for documentation about it. Fixes zsh-users#736
+1 |
Terraform completion is another one impacted by this bug. ~/.zshrc[...]
autoload -U +X bashcompinit && bashcompinit
complete -o nospace -C "$(which terraform)" terraform
When running the complete command manually on my shell, completions get loaded, but not when they are loaded from |
+1 I'm a shell noob, but here's how I would describe it: Antigen causes
The interwebs suggested various problems with |
Description
The google-cloud-sdk adds the following snippet to the end of your
.zshrc
:Their completion script is using
bashcompinit
andcomplete
to define completions. This translates to a bunch ofcompdef
calls like this:compdef '_bash_complete -o nospace -o default -F _python_argcomplete' gcloud
If this happens after
antigen apply
, thecompdef
is ignored:antigen/bin/antigen.zsh
Line 1843 in 64de2dc
Which is weird...? Why?
Moving it between sourcing antigen and
antigen apply
causes antigen to defer thecompdef
call using:antigen/bin/antigen.zsh
Line 64 in 64de2dc
Which causes it to save it as a single string inside the array, losing the quoting and the fact that it has multiple arguments, and then the subsequent
compdef
call here doesn't work:antigen/bin/antigen.zsh
Line 802 in 64de2dc
As it needs to call
compdef
with two arguments but calls it with one.In general, I think this might happen with any
compdef
call at all, as they all use more than one argument.Also note that
nvm
generates the following:And its completion script calls
compinit
, which antigen isn't trying to defer/skip, which will then undo the effect of deferringcompdef
(nvm-sh/nvm/bash_completion:89-95) getting the completion to be defined correctly but hurting shell startup performance due to multiplecompinit
invocations. Making it not callcompinit
by commenting that out, causes the same kind of issue with its own defined completions not loading as happens with thegoogle-cloud-sdk
, althoughnvm
has completion available in the Zsh default completion and an oh-my-zsh plugin with completions that will end up getting used instead.You can load such completions before sourcing antigen, which will make it call
compdef
before antigen tries to defer it, which seems to work, but there might be a reason for this attempted deferral ofcompdef
calls.I'm not really sure how to resolve this as Zsh doesn't support nested arrays or something obvious to store an array of such multiple argument commands...
P.S. As antigen doesn't appear to be maintained, this is unlikely to be resolved, any recommendations for an alternative to antigen (With good oh-my-zsh plugins support, good performance, and being actually maintained), workaround, fix to apply locally, or anything else?
Steps to reproduce
Minimal steps to reproduce this behavior. Example:
Expected behavior:
Software version
antigen version
Antigen v2.2.3 (ff391b5)
Revision date: 2018-01-02 13:19:57 +0100
zsh --version
zsh 5.8 (x86_64-apple-darwin21.0)uname -a
Darwin Segevs-MacBook-Pro.local 21.4.0 Darwin Kernel Version 21.4.0: Fri Mar 18 00:46:32 PDT 2022; root:xnu-8020.101.4~15/RELEASE_ARM64_T6000 arm64Configuration
.zshrc
More information
😢
The text was updated successfully, but these errors were encountered: