Move `pip` to separate completion definition delegating to pip to do all the completion work. Since the completion is loaded lazily on-demand, it avoids the performance overhead during Zsh initialization. Implementation note: The helper function `_pip_completion` implementation is based on the official pip completion function (which can be generated with `pip completion --zsh`) adhering to the newer compsys style. See: 'man zshcompsys' for more details.pull/1941/head
parent
d686da3c03
commit
f0942e6dda
@ -0,0 +1,19 @@
|
||||
#compdef -P pip[0-9.]#
|
||||
#autoload
|
||||
|
||||
#
|
||||
# Pip completion, delegating to pip to do all the completion work.
|
||||
#
|
||||
# Authors:
|
||||
# Indrajit Raychaudhuri <irc@indrajit.com>
|
||||
#
|
||||
|
||||
if (( $+commands[$words[1]] )); then
|
||||
|
||||
function _pip_completion {
|
||||
compadd -- $( COMP_WORDS="$words[*]" COMP_CWORD=$(( CURRENT - 1 )) \
|
||||
PIP_AUTO_COMPLETE=1 $words[1] 2>/dev/null )
|
||||
}
|
||||
_pip_completion "$@"
|
||||
|
||||
fi
|
Loading…
Reference in new issue