Skip to content

Commit

Permalink
Update completion functions
Browse files Browse the repository at this point in the history
  • Loading branch information
kdeldycke committed Jul 29, 2024
1 parent 99491ec commit 9e5e39b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
8 changes: 7 additions & 1 deletion dotfiles/.zfunc/_mpm
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,10 @@ _mpm_completion() {
fi
}

compdef _mpm_completion mpm;
if [[ $zsh_eval_context[-1] == loadautofunc ]]; then
# autoload from fpath, call function directly
_mpm_completion "$@"
else
# eval/source/. command, register function for later
compdef _mpm_completion mpm
fi
20 changes: 12 additions & 8 deletions dotfiles/.zfunc/_pip
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@

# pip zsh completion start
function _pip_completion {
local words cword
read -Ac words
read -cn cword
reply=( $( COMP_WORDS="$words[*]" \
COMP_CWORD=$(( cword-1 )) \
PIP_AUTO_COMPLETE=1 $words[1] 2>/dev/null ))
#compdef -P pip[0-9.]#
__pip() {
compadd $( COMP_WORDS="$words[*]" \
COMP_CWORD=$((CURRENT-1)) \
PIP_AUTO_COMPLETE=1 $words[1] 2>/dev/null )
}
compctl -K _pip_completion /opt/homebrew/opt/python@3.9/bin/python3.9 -m pip
if [[ $zsh_eval_context[-1] == loadautofunc ]]; then
# autoload from fpath, call function directly
__pip "$@"
else
# eval/source/. command, register function for later
compdef __pip -P 'pip[0-9.]#'
fi
# pip zsh completion end

0 comments on commit 9e5e39b

Please sign in to comment.