diff --git a/.zsh/complete/_config b/.zsh/complete/_config new file mode 100644 index 0000000..51176e5 --- /dev/null +++ b/.zsh/complete/_config @@ -0,0 +1,25 @@ +#compdef _config config +set -eo pipefail + +typeset -A opt_args + +function _config() { + #set -x + _arguments -C \ + '1:repo:->repos' \ + '*::: :->args' + + case "$state" in + repos) + local repos + repos=($(ls -1 "${HOME}/.cfg")) + _describe 'repos' repos + ;; + args) + _dispatch git -default- + ;; + *) + return 1 + ;; + esac +} diff --git a/.zsh/config.sh b/.zsh/config.sh index 291edb2..d8844a8 100644 --- a/.zsh/config.sh +++ b/.zsh/config.sh @@ -59,3 +59,7 @@ source ${HOME}/.zsh/peco.sh ## Clean PATH from duplicates export PATH=$(${HOME}/bin/path-dedup.py) + +## Add custom auto-completions +export fpath=("${HOME}/.zsh/complete" $fpath) +compinit