Merge pull request #995 from wting/fix_gnzh_ruby_detection
Fix gnzh theme to detect local rvm installations
Diff
1diff --git a/themes/gnzh.zsh-theme b/themes/gnzh.zsh-theme
2index 3c6b8a409f6de3d5750cacff36edfdaad764e003..33f187bc6cd42770ae74329e769128c472b300e7 100644
3--- a/themes/gnzh.zsh-theme
4+++ b/themes/gnzh.zsh-theme
5@@ -6,7 +6,7 @@ autoload -U colors zsh/terminfo # Used in the colour alias below
6 colors
7 setopt prompt_subst
8 9-# make some aliases for the colours: (coud use normal escap.seq's too)
10+# make some aliases for the colours: (could use normal escape sequences too)
11 for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE; do
12 eval PR_$color='%{$fg[${(L)color}]%}'
13 done
14@@ -25,7 +25,7 @@ elif [[ $UID -eq 0 ]]; then # root
15 fi
1617 # Check if we are on SSH or not
18-if [[ -n "$SSH_CLIENT" || -n "$SSH2_CLIENT" ]]; then
19+if [[ -n "$SSH_CLIENT" || -n "$SSH2_CLIENT" ]]; then
20 eval PR_HOST='${PR_YELLOW}%M${PR_NO_COLOR}' #SSH
21 else
22 eval PR_HOST='${PR_GREEN}%M${PR_NO_COLOR}' # no SSH
23@@ -36,12 +36,12 @@ local return_code="%(?..%{$PR_RED%}%? ↵%{$PR_NO_COLOR%})"
24 local user_host='${PR_USER}${PR_CYAN}@${PR_HOST}'
25 local current_dir='%{$PR_BOLD$PR_BLUE%}%~%{$PR_NO_COLOR%}'
26 local rvm_ruby=''
27-if which rvm-prompt &> /dev/null; then
28+if ${HOME}/.rvm/bin/rvm-prompt &> /dev/null; then # detect local user rvm installation
29+ rvm_ruby='%{$PR_RED%}‹$(${HOME}/.rvm/bin/rvm-prompt i v g s)›%{$PR_NO_COLOR%}'
30+elif which rvm-prompt &> /dev/null; then # detect sysem-wide rvm installation
31 rvm_ruby='%{$PR_RED%}‹$(rvm-prompt i v g s)›%{$PR_NO_COLOR%}'
32-else
33- if which rbenv &> /dev/null; then
34- rvm_ruby='%{$PR_RED%}‹$(rbenv version | sed -e "s/ (set.*$//")›%{$PR_NO_COLOR%}'
35- fi
36+elif which rbenv &> /dev/null; then # detect Simple Ruby Version management
37+ rvm_ruby='%{$PR_RED%}‹$(rbenv version | sed -e "s/ (set.*$//")›%{$PR_NO_COLOR%}'
38 fi
39 local git_branch='$(git_prompt_info)%{$PR_NO_COLOR%}'
40