Skip to content

alltuner/mise-completions-sync

Repository files navigation

mise-completions-sync

Sync shell completions for tools managed by mise.
One command keeps Bash, Zsh, and Fish completions current as mise installs and removes tools.

Docs · Sponsor

crates.io License Stars


Get Started

Install via Homebrew, Cargo, mise, or grab a prebuilt binary:

brew install alltuner/tap/mise-completions-sync
cargo install mise-completions-sync
mise use -g github:alltuner/mise-completions-sync

The installed binary is named misecompsync (mise reserves mise-* names for itself, so the shim can't forward to a binary that starts with mise-).

Then add the completions directory to your shell config:

Shell Where to add Snippet
Zsh ~/.zshrc (before compinit) fpath=(${XDG_DATA_HOME:-$HOME/.local/share}/mise-completions/zsh $fpath)
Bash ~/.bashrc for f in ${XDG_DATA_HOME:-$HOME/.local/share}/mise-completions/bash/*; do [[ -f "$f" ]] && source "$f"; done
Fish ~/.config/fish/config.fish set -gx fish_complete_path $fish_complete_path ~/.local/share/mise-completions/fish

What is mise-completions-sync?

mise installs language and tool versions per project, but it doesn't touch your shell completion files. As versions change, completions get stale or missing. mise-completions-sync walks your installed mise tools, generates the right completion file for each one (Bash, Zsh, Fish), and writes them under ${XDG_DATA_HOME:-$HOME/.local/share}/mise-completions/<shell>/. Run it once after installing tools, or wire it into a mise post-install hook.

Usage

# Sync completions for all installed tools
misecompsync

# Sync only for a specific shell
misecompsync --shell zsh

# Sync specific tools
misecompsync kubectl helm

# List supported tools
misecompsync list

# Clean up completions for uninstalled tools
misecompsync clean

# Print misecompsync's own completions to stdout
misecompsync completion zsh

Automatic sync

Wire it into a mise post-install hook so new tool installs get completions automatically:

mkdir -p ~/.config/mise && cat >> ~/.config/mise/config.toml << 'EOF'

[hooks]
postinstall = "misecompsync"
EOF

Custom Output Dirs

By default, completions are synced to $XDG_DATA_HOME/mise-completions/<shell>. However, you can override the output directories using environment variables:

# Override default base output directory
export MISE_COMPLETIONS_SYNC_HOME="$XDG_DATA_HOME/custom-vendor-completions"

Or you can override output targets on a per-shell basis (these take precedence over the base override above):

# Bash completions to standard bash location
export MISE_COMPLETIONS_SYNC_BASH_DIR="$XDG_DATA_HOME/bash-completion/completions"

# ZSH completions to standard zsh location
export MISE_COMPLETIONS_SYNC_ZSH_DIR="$XDG_DATA_HOME/zsh/site-functions"

# Fish completions to standard fish locations.
# (pick one or the other, both are autoloaded by fish)
# export MISE_COMPLETIONS_SYNC_FISH_DIR="$XDG_CONFIG_HOME/fish/completions"
export MISE_COMPLETIONS_SYNC_FISH_DIR="$XDG_DATA_HOME/fish/vendor_completions.d"

Note: Target directories will be created if they don't already exist. Don't forget to update your shell setup above.

If you want to only generate completions for newly installed or updated tools, you can add the flag --new-only:

[hooks]
postinstall = "misecompsync --new-only"

Updating

# Homebrew
brew upgrade mise-completions-sync

# Cargo
cargo install --force mise-completions-sync

# mise
mise upgrade github:alltuner/mise-completions-sync

# Pin a specific version with mise
mise use -g github:alltuner/mise-completions-sync@0.5.1

Documentation

Full docs at alltuner.github.io/mise-completions-sync — supported tools, completion details, and troubleshooting.

License

MIT

Support the project

mise-completions-sync is an open source project built by David Poblador i Garcia through All Tuner Labs.

If this project was useful to you, consider supporting its development.


Built by David Poblador i Garcia with the support of All Tuner Labs.
Made with ❤️ in Poblenou, Barcelona.

About

Automatically sync shell completions for tools managed by mise

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors