Skip to main content

Command Palette

Search for a command to run...

Rust, cargo with ZSH (auto complete)

Updated
1 min read
T

10+ years most with Ruby on Rails and JavaScript frontend and some Go. My first language is C for 3 years in university.

It is as simple as:

rustup completions zsh > ~/.zfunc/_rustup
rustup completions zsh cargo > ~/.zfunc/_cargo

With a TAB you get the auto-complete or the options available:

❯ cargo b
b      -- alias: build
bench  -- Execute all benchmarks of a local package
build  -- Compile a local package and all of its dependencies

If ZSH isn’t yet configured, create the folder mkdir ~/.zfunc and in ~/.zshrc:

export FPATH="$HOME/.zfunc:${FPATH}"
compinit