mirror of
https://github.com/dcarrillo/prezto.git
synced 2024-12-23 00:17:59 +00:00
Add support for 'pip', 'pip2', 'pip3' completion
Since `pip completion --zsh` might be slow, we cache it beforehand. The implementation is along the lines of 'npm' completion in 'node' module.
This commit is contained in:
parent
876f426581
commit
4f87376b50
@ -46,6 +46,20 @@ if (( $? && $+commands[virtualenvwrapper.sh] )); then
|
|||||||
source "$commands[virtualenvwrapper.sh]"
|
source "$commands[virtualenvwrapper.sh]"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Load PIP completion.
|
||||||
|
if (( $+commands[pip] )); then
|
||||||
|
cache_file="${0:h}/cache.zsh"
|
||||||
|
|
||||||
|
if [[ "$commands[pip]" -nt "$cache_file" || ! -s "$cache_file" ]]; then
|
||||||
|
# pip is slow; cache its output. And also support 'pip2', 'pip3' variants
|
||||||
|
pip completion --zsh | sed -e "s|compctl -K [-_[:alnum:]]* pip|& pip2 pip3|" >! "$cache_file" 2> /dev/null
|
||||||
|
fi
|
||||||
|
|
||||||
|
source "$cache_file"
|
||||||
|
|
||||||
|
unset cache_file
|
||||||
|
fi
|
||||||
|
|
||||||
#
|
#
|
||||||
# Aliases
|
# Aliases
|
||||||
#
|
#
|
||||||
|
Loading…
Reference in New Issue
Block a user