diff options
| author | Alexander Schaber <alexander@schaber.info> | 2024-09-27 13:58:56 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-09-27 13:58:56 +0200 |
| commit | a72a26406ad3aa9a47c3f5227291bad23494bed0 (patch) | |
| tree | 11f7a4b963b84764ca5f7a0a37df620ea1f9761f /plugins/chezmoi/chezmoi.plugin.zsh | |
| parent | 2a2f8ecb67674538b4b267f0796673f779f0ae5d (diff) | |
| download | zsh-a72a26406ad3aa9a47c3f5227291bad23494bed0.tar.gz zsh-a72a26406ad3aa9a47c3f5227291bad23494bed0.tar.bz2 zsh-a72a26406ad3aa9a47c3f5227291bad23494bed0.zip | |
feat(chezmoi): add completion plugin (#12696)
Diffstat (limited to 'plugins/chezmoi/chezmoi.plugin.zsh')
| -rw-r--r-- | plugins/chezmoi/chezmoi.plugin.zsh | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/plugins/chezmoi/chezmoi.plugin.zsh b/plugins/chezmoi/chezmoi.plugin.zsh new file mode 100644 index 000000000..80e19fea1 --- /dev/null +++ b/plugins/chezmoi/chezmoi.plugin.zsh @@ -0,0 +1,14 @@ +# COMPLETION FUNCTION +if (( ! $+commands[chezmoi] )); then + return +fi + +# If the completion file doesn't exist yet, we need to autoload it and +# bind it to `chezmoi`. Otherwise, compinit will have already done that. +if [[ ! -f "$ZSH_CACHE_DIR/completions/_chezmoi" ]]; then + typeset -g -A _comps + autoload -Uz _chezmoi + _comps[chezmoi]=_chezmoi +fi + +chezmoi completion zsh >| "$ZSH_CACHE_DIR/completions/_chezmoi" &| |
