From 40c2395f434b85b031ac77895d42913c3b60712a Mon Sep 17 00:00:00 2001 From: "Kenneth Benzie (Benie)" Date: Mon, 1 Jan 2018 18:28:42 +0000 Subject: [PATCH] Add default pip completion The default pip completion is suboptimal because it uses the old Zsh completion engine which is compatible with bash. --- zshrc | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/zshrc b/zshrc index 7bfd75c..5325294 100644 --- a/zshrc +++ b/zshrc @@ -41,6 +41,19 @@ unsetopt flow_control && stty -ixon autoload -U compinit compinit +# Add pip to the old completion engine if present +if which pip &> /dev/null; then + 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] ) ) + } + compctl -K _pip_completion pip +fi + # Enable prompt themes autoload -Uz promptinit promptinit