-
Notifications
You must be signed in to change notification settings - Fork 895
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
ZSH Cargo autocompletion not working #1821
Comments
I imagine this is an issue with the zsh completions provided for cargo, rather than rustup itself. I have just tried manually installing the cargo completions into my zsh setup and can confirm they seem to do nothing. I'd suggest filing an issue against https://github.com/rust-lang/cargo referencing this issue so that we can discuss it usefully across the projects. |
I'm not sure, but it seems to be an issue with how rustup is creating a completion file using |
@ehuss I didn't even know about the completion dump file and that Why doesn't source $(rustc --print sysroot)/share/zsh/site-functions/_cargo and add the line to it: #compdef cargo
source $(rustc --print sysroot)/share/zsh/site-functions/_cargo it works just fine. I feel dumb now for not going all the way with this from the start 🤦♂️ Anyway, submitted a PR for this: #1995 |
If anyone here can confirm the work on #1995 then I'd appreciate it. |
Fix generation of Cargo completions for ZSH (issue #1821)
LGTM, but the autocompletion for Cargo only appears to load if I run |
So, how does one get cargo completion working at this point? Via adding #compdef cargo
source $(rustc --print sysroot)/share/zsh/site-functions/_cargo to your |
@murlakatamenka No, you just add the echo `#compdef cargo` > ~/.zfunc/_cargo
rustup completions zsh cargo >> ~/.zfunc/_cargo If you haven't already, you should put this line in your
Also remove the rm ~/.zcompdump It will dump the new configuration into |
Just to be clear, I am using oh my zsh, so in my case things are a little bit different: echo `#compdef cargo` > ~/.oh-my-zsh/completions/_cargo
rustup completions zsh cargo >> ~/.oh-my-zsh/completions/_cargo My export ZSH=$HOME/.oh-my-zsh
ZSH_THEME="juanghurtado"
source $ZSH/oh-my-zsh.sh
autoload -U compinit && compinit
... |
@burjui thanks, it worked! 👍 |
This is already fixed in rustup 1.20+, the issue can be closed, right? @burjui btw oh-my-zsh has its own cargo plugin but it's not up-to-date. I've stopped on this 👇 rustup completions zsh cargo > ~/.zsh/completions/_cargo
export ZSH=/usr/share/oh-my-zsh
plugins=(...)
fpath+=~/.zsh/completions
source $ZSH/oh-my-zsh.sh
autoload -U compinit && compinit |
Thank you @murlakatamenka for your input. I'll close this then. |
To make this a oneliner, use |
@drahnr thanks for the tip. Actually |
if you using oh-my-zhs add |
Problem
cargo
tab completion is not working. I installed it the same way I didrustup
, which works.Steps
rustup completions zsh cargo > /usr/local/share/zsh-completions/_cargo
.zshrc
I have.zshrc
Notes
Output of
rustup --version
: rustup 1.18.1 (462683b 2019-04-25)Output of
rustup show
:The text was updated successfully, but these errors were encountered: