Shells

Where each completion script is installed, and how to do it by hand.

minato completions <shell> --install writes the script where the shell reads it and, where the shell cannot find that file on its own, adds a managed block to your shell’s configuration:

# >>> minato completions >>>
# <<< minato completions <<<

Re-running replaces that block. --uninstall removes it, and nothing else. --dry-run reports every path either touches, and touches none of them.

Leave the shell out and it is taken from $SHELL:

Terminal
minato completions --install

An install already in place stays where it is

Each table below says where a first install goes. Once a script is on disk, that is the file --install updates, even when the machine has since gained Oh My Zsh, Homebrew, or bash-completion and a first install now chooses somewhere else. Copies in the other locations it knows about are removed on the way, so nothing is left behind to shadow the file that is kept.

To move an install, remove it and install again:

Terminal
minato completions zsh --uninstall
minato completions zsh --install

bash

What Where
Installed to $XDG_DATA_HOME/bash-completion/completions/minato when that directory exists, otherwise $XDG_DATA_HOME/minato-completions/minato.bash
Configuration None in the first case, a source line in ~/.bashrc in the second

$XDG_DATA_HOME defaults to ~/.local/share.

Manual install:

Terminal
mkdir -p ~/.local/share/bash-completion/completions
minato completions bash > ~/.local/share/bash-completion/completions/minato

zsh

What Where
Installed to The first that applies: $ZSH_CUSTOM/completions/_minato under Oh My Zsh, $HOMEBREW_PREFIX/share/zsh/site-functions/_minato under Homebrew, otherwise ~/.zfunc/_minato
Configuration None in the first two cases, an fpath line in ~/.zshrc followed by compinit in the third

zsh loads completion functions from the directories on fpath, and only once compinit has run. zsh has no per-user directory of its own on that list, which is why the destination depends on what else is installed.

Oh My Zsh already puts $ZSH_CUSTOM/completions on fpath and calls compinit itself, both while ~/.zshrc is still sourcing it. Anything appended below that runs too late to matter, so the file goes there and your configuration is left alone. $ZSH_CUSTOM defaults to ~/.oh-my-zsh/custom, and is followed only when it points inside your home directory.

Homebrew’s own shell setup puts $HOMEBREW_PREFIX/share/zsh/site-functions on fpath for the same reason, so a file written there also needs no configuration. It is used only when that directory already exists and you can write to it, and never with sudo.

Otherwise the file goes to ~/.zfunc, and the managed block adds that directory to fpath and calls compinit -i. It has to be -i rather than -C: -C omits the check for new completion functions and reuses the existing dump, and by the time the block runs your own compinit has usually written one, which leaves _minato unseen.

Alongside those three, $XDG_DATA_HOME/zsh/site-functions/_minato is found and cleaned up, since an earlier version of these instructions pointed there.

Manual install:

Terminal
mkdir -p ~/.zfunc
minato completions zsh > ~/.zfunc/_minato
~/.zshrc
fpath=(~/.zfunc $fpath)
autoload -Uz compinit && compinit -i

fish

What Where
Installed to $XDG_CONFIG_HOME/fish/completions/minato.fish
Configuration None

fish autoloads that directory, so there is nothing to add to config.fish.

Manual install:

Terminal
mkdir -p ~/.config/fish/completions
minato completions fish > ~/.config/fish/completions/minato.fish

elvish

What Where
Installed to $XDG_CONFIG_HOME/elvish/lib/minato.elv
Configuration use minato in ~/.config/elvish/rc.elv

The script is inert until it is used, so the file alone does not finish the job.

Manual install:

Terminal
mkdir -p ~/.config/elvish/lib
minato completions elvish > ~/.config/elvish/lib/minato.elv
~/.config/elvish/rc.elv
use minato

PowerShell

What Where
Installed to Nothing on disk
Configuration The line below in the file $PROFILE names

PowerShell evaluates the script rather than reading it from a completions directory, so --install has nothing to write and says so.

PowerShell
minato completions powershell | Out-String | Invoke-Expression

Because it is regenerated at every session, it can never go stale, which is why minato doctor does not report on it.

Keeping them current

A completion script is a copy of the command surface from the moment it was generated, so an upgrade that adds a command leaves it offering the old set.

Terminal
minato doctor

The completions check compares every script it finds, byte for byte, against what this binary generates now, and names the command to run for each one that has drifted. A shell you have not set up is never mentioned.

Back to top