From 638cfb79bdbf4fb6dc7d18122575a398cd73bc47 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Sat, 27 Aug 2011 19:09:06 -0400 Subject: [PATCH] Added Python plugin, moved pip completion into it. --- plugins/{pip => python}/_pip | 9 +++++---- plugins/python/python.plugin.zsh | 11 +++++++++++ 2 files changed, 16 insertions(+), 4 deletions(-) rename plugins/{pip => python}/_pip (89%) create mode 100644 plugins/python/python.plugin.zsh diff --git a/plugins/pip/_pip b/plugins/python/_pip similarity index 89% rename from plugins/pip/_pip rename to plugins/python/_pip index b5801017..ea2b0c3f 100644 --- a/plugins/pip/_pip +++ b/plugins/python/_pip @@ -1,9 +1,9 @@ #compdef pip #autoload -# pip zsh completion, based on homebrew completion +# This completion is based on the Homebrew completion. -_pip_installed() { +function _pip-installed() { installed_pkgs=(`pip freeze`) } @@ -37,10 +37,11 @@ fi case "$words[1]" in list) if [[ "$state" == forms ]]; then - _pip_installed + _pip-installed _requested installed_pkgs expl 'installed packages' compadd -a installed_pkgs fi ;; uninstall) - _pip_installed + _pip-installed _wanted installed_pkgs expl 'installed packages' compadd -a installed_pkgs ;; esac + diff --git a/plugins/python/python.plugin.zsh b/plugins/python/python.plugin.zsh new file mode 100644 index 00000000..3bc947c4 --- /dev/null +++ b/plugins/python/python.plugin.zsh @@ -0,0 +1,11 @@ +# Prepend PEP 370 per user site packages directory, which defaults to +# ~/Library/Python on Mac OS X and ~/.local elsewhere, to PATH/MANPATH. +if [[ "$OSTYPE" == darwin* ]]; then + path=($HOME/Library/Python/*/bin(N) $path) + manpath=($HOME/Library/Python/*/{,share/}man(N) $manpath) +else + # This is subject to change. + path=($HOME/.local/bin $path) + manpath=($HOME/.local/{,share/}man(N) $manpath) +fi +