diff options
-rw-r--r-- | plugins/bundler/bundler.plugin.zsh | 48 | ||||
-rw-r--r-- | plugins/python/python.plugin.zsh | 1 | ||||
-rw-r--r-- | themes/agnoster.zsh-theme | 2 | ||||
-rw-r--r-- | themes/linuxonly.zsh-theme (renamed from themes/linuxonly) | 0 |
4 files changed, 27 insertions, 24 deletions
diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/bundler.plugin.zsh index 2e657e5a8..e390f8620 100644 --- a/plugins/bundler/bundler.plugin.zsh +++ b/plugins/bundler/bundler.plugin.zsh @@ -4,18 +4,6 @@ alias bp="bundle package" alias bo="bundle open" alias bu="bundle update" -bundler_version=`bundle version | cut -d' ' -f3` -if [[ $bundler_version > '1.4.0' || $bundler_version = '1.4.0' ]]; then - if [[ "$(uname)" == 'Darwin' ]] - then - local cores_num="$(sysctl hw.ncpu | awk '{print $2}')" - else - local cores_num="$(nproc)" - fi - eval "alias bi='bundle install --jobs=$cores_num'" -else - alias bi='bundle install' -fi # The following is based on https://github.com/gma/bundler-exec @@ -44,14 +32,28 @@ _run-with-bundler() { fi } -## Main program -for cmd in $bundled_commands; do - eval "function unbundled_$cmd () { $cmd \$@ }" - eval "function bundled_$cmd () { _run-with-bundler $cmd \$@}" - alias $cmd=bundled_$cmd - - if which _$cmd > /dev/null 2>&1; then - compdef _$cmd bundled_$cmd=$cmd - fi -done - +if _bundler-installed; then + bundler_version=`bundle version | cut -d' ' -f3` + if [[ $bundler_version > '1.4.0' || $bundler_version = '1.4.0' ]]; then + if [[ "$(uname)" == 'Darwin' ]] + then + local cores_num="$(sysctl hw.ncpu | awk '{print $2}')" + else + local cores_num="$(nproc)" + fi + eval "alias bi='bundle install --jobs=$cores_num'" + else + alias bi='bundle install' + fi + + ## Main program + for cmd in $bundled_commands; do + eval "function unbundled_$cmd () { $cmd \$@ }" + eval "function bundled_$cmd () { _run-with-bundler $cmd \$@}" + alias $cmd=bundled_$cmd + + if which _$cmd > /dev/null 2>&1; then + compdef _$cmd bundled_$cmd=$cmd + fi + done +fi diff --git a/plugins/python/python.plugin.zsh b/plugins/python/python.plugin.zsh index 852c8b919..a8f9760ad 100644 --- a/plugins/python/python.plugin.zsh +++ b/plugins/python/python.plugin.zsh @@ -6,6 +6,7 @@ alias pyfind='find . -name "*.py"' function pyclean() { ZSH_PYCLEAN_PLACES=${*:-'.'} find ${ZSH_PYCLEAN_PLACES} -type f -name "*.py[co]" -delete + find ${ZSH_PYCLEAN_PLACES} -type d -name "__pycache__" -delete } # Grep among .py files diff --git a/themes/agnoster.zsh-theme b/themes/agnoster.zsh-theme index 2db565266..2836de4b7 100644 --- a/themes/agnoster.zsh-theme +++ b/themes/agnoster.zsh-theme @@ -137,7 +137,7 @@ prompt_dir() { # Virtualenv: current working virtualenv prompt_virtualenv() { local virtualenv_path="$VIRTUAL_ENV" - if [[ -n $virtualenv_path && -z $VIRTUAL_ENV_DISABLE_PROMPT ]]; then + if [[ -n $virtualenv_path && -n $VIRTUAL_ENV_DISABLE_PROMPT ]]; then prompt_segment blue black "(`basename $virtualenv_path`)" fi } diff --git a/themes/linuxonly b/themes/linuxonly.zsh-theme index a11b80d7f..a11b80d7f 100644 --- a/themes/linuxonly +++ b/themes/linuxonly.zsh-theme |