diff options
author | Dominik Ritter <dritter03@googlemail.com> | 2018-06-07 02:21:16 +0300 |
---|---|---|
committer | Dominik Ritter <dritter03@googlemail.com> | 2018-06-07 02:21:16 +0300 |
commit | 3456af3aac62dcdbcf117b4f73276fac4a3c82fd (patch) | |
tree | 3e126ee1315ac42ee6990c8a4d9ae91592baeccc /powerlevel9k.zsh-theme | |
parent | d3500625ca8646dfaaf91103cc5c33c74a958955 (diff) | |
parent | fbb85e77e3dc307c21b79c655302158077fad916 (diff) |
Merge remote-tracking branch 'opes/chruby_options' into staging_065
Diffstat (limited to 'powerlevel9k.zsh-theme')
-rwxr-xr-x | powerlevel9k.zsh-theme | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index c0107eab..a6e0ac2a 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -1252,11 +1252,24 @@ prompt_rbenv() { # Segment to display chruby information # see https://github.com/postmodern/chruby/issues/245 for chruby_auto issue with ZSH prompt_chruby() { - local chruby_env - chrb_env="$(chruby 2> /dev/null | grep \* | tr -d '* ')" + # Uses $RUBY_VERSION and $RUBY_ENGINE set by chruby + set_default POWERLEVEL9K_CHRUBY_SHOW_VERSION true + set_default POWERLEVEL9K_CHRUBY_SHOW_ENGINE true + local chruby_label="" + + if [[ "$POWERLEVEL9K_CHRUBY_SHOW_ENGINE" == true ]]; then + chruby_label+="$RUBY_ENGINE " + fi + if [[ "$POWERLEVEL9K_CHRUBY_SHOW_VERSION" == true ]]; then + chruby_label+="$RUBY_VERSION" + fi + + # Truncate trailing spaces + chruby_label="${chruby_label%"${chruby_label##*[![:space:]]}"}" + # Don't show anything if the chruby did not change the default ruby - if [[ "${chrb_env:-system}" != "system" ]]; then - "$1_prompt_segment" "$0" "$2" "red" "$DEFAULT_COLOR" "${chrb_env}" 'RUBY_ICON' + if [[ "$RUBY_ENGINE" != "" ]]; then + "$1_prompt_segment" "$0" "$2" "red" "$DEFAULT_COLOR" "${chruby_label}" 'RUBY_ICON' fi } |