Add utility to generate shell completions

This commit is contained in:
Alexander Hess 2026-08-03 09:36:33 +02:00
commit 1ffce9ed20
Signed by: alexander
GPG key ID: B46EDB4DFC26805D
4 changed files with 137 additions and 0 deletions

6
.zshrc
View file

@ -63,12 +63,18 @@ stty -ixon # Prevent <Control>s from freezing `zsh`
# Enable (tab) completions
# Look for completion files generated by ~/.local/bin/generate-shell-completions
fpath=("${XDG_DATA_HOME:-$HOME/.local/share}/zsh/completions" $fpath)
# "-u" disables the ownership check on completion dirs, which is safe since only we write to them
autoload -Uz compinit && compinit -u -d "${XDG_STATE_HOME:-$HOME/.local/state}/zsh/zcompdump"
# Complete the `--force` flag of the `dotfiles` utilities in ~/.local/bin
compdef '_arguments "--force[skip safety checks / reinstall]"' dotfiles-install dotfiles-update
# Complete the `--quieter` flag of the `generate-shell-completions` utility in ~/.local/bin
compdef '_arguments "--quieter[suppress the reload hint]"' generate-shell-completions
# Enable match highlighting and scrolling through long lists,
# and provide a different style of menu completion
zmodload zsh/complist