4dc11fee35f21b295deb1a61503031c8e17f83a1

Author
Max Gonzih <gonzih@gmail.com>
Committer
Max Gonzih <gonzih@gmail.com>
Date

Message

detect rvm or rbenv and show ruby version

Diff

 1diff --git a/themes/gnzh.zsh-theme b/themes/gnzh.zsh-theme
 2index 357798cf6a02e5adb615629bc3da9bebd23c505d..7765efbf2c61dd94937dd6a7812061e162def0cc 100644
 3--- a/themes/gnzh.zsh-theme
 4+++ b/themes/gnzh.zsh-theme
 5@@ -1,4 +1,4 @@
 6-# ZSH Theme - Preview: http://dl.dropbox.com/u/4109351/pics/gnzh-zsh-theme.png
 7+# ZSH Theme - Preview: http://gyazo.com/8becc8a7ed5ab54a0262a470555c3eed.png
 8 # Based on bira theme
 9 
10 # load some modules
11@@ -35,9 +35,17 @@ local return_code="%(?..%{$PR_RED%}%? ↵%{$PR_NO_COLOR%})"
12 
13 local user_host='${PR_USER}${PR_CYAN}@${PR_HOST}'
14 local current_dir='%{$PR_BOLD$PR_BLUE%}%~%{$PR_NO_COLOR%}'
15-local rvm_ruby='%{$PR_RED%}‹$(rvm-prompt i v g s)›%{$PR_NO_COLOR%}'
16+local rvm_ruby=''
17+if which rvm-prompt &> /dev/null; then
18+  rvm_ruby='%{$PR_RED%}‹$(rvm-prompt i v g s)›%{$PR_NO_COLOR%}'
19+else
20+  if which rbenv &> /dev/null; then
21+    rvm_ruby='%{$PR_RED%}‹$(rbenv version | sed -e "s/ (set.*$//")›%{$PR_NO_COLOR%}'
22+  fi
23+fi
24 local git_branch='$(git_prompt_info)%{$PR_NO_COLOR%}'
25 
26+#PROMPT="${user_host} ${current_dir} ${rvm_ruby} ${git_branch}$PR_PROMPT "
27 PROMPT="╭─${user_host} ${current_dir} ${rvm_ruby} ${git_branch}
28 ╰─$PR_PROMPT "
29 RPS1="${return_code}"