After installing Rust using this command:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
I was trying to find a way to add the auto-completions for rustup
and cargo
.
Now that i have done it, i am sharing the way i did it for future reference and for anyone facing the same issue. If you have a better solution please share it here.
-
Generate the auto-completions for
cargo
andrustup
and save them to Downloads/:
rustup completions zsh > ~/Downloads/_rustup && rustup completions zsh cargo > ~/Downloads/_cargo
-
Move the files generated to /usr/share/zsh/functions/Completion/Zsh/:
sudo mv ~/Downloads/_cargo ~/Downloads/_rustup /usr/share/zsh/functions/Completion/Zsh/
-
Refresh zsh:
exec zsh