mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2025-12-26 02:12:33 +01:00
Intelligently select between RVM and rbenv
This commit is contained in:
parent
757fa3314d
commit
138fe8f2ff
1 changed files with 16 additions and 5 deletions
|
|
@ -27,11 +27,22 @@ ZSH_THEME_GIT_PROMPT_SUFFIX=""
|
|||
ZSH_THEME_GIT_PROMPT_CLEAN=" $CRUNCH_GIT_CLEAN_COLOR✓"
|
||||
ZSH_THEME_GIT_PROMPT_DIRTY=" $CRUNCH_GIT_DIRTY_COLOR✗"
|
||||
|
||||
# Intelligently show Ruby version if the 'rbenv' or 'rvm' plugins are active.
|
||||
for plugin ($plugins); do
|
||||
if [[ $plugin = 'rvm' ]]; then
|
||||
CRUNCH_RUBY_VERSION="\${\$(rvm-prompt i v g)#ruby-}"
|
||||
elif [[ $plugin = 'rbenv' ]]; then
|
||||
CRUNCH_RUBY_VERSION="\${\$(rbenv_prompt_info)%%-*}"
|
||||
fi
|
||||
done
|
||||
|
||||
# Our elements:
|
||||
CRUNCH_TIME_="$CRUNCH_BRACKET_COLOR{$CRUNCH_TIME_COLOR%T$CRUNCH_BRACKET_COLOR}%{$reset_color%}"
|
||||
CRUNCH_RVM_="$CRUNCH_BRACKET_COLOR"["$CRUNCH_RVM_COLOR\${\$(~/.rvm/bin/rvm-prompt i v g)#ruby-}$CRUNCH_BRACKET_COLOR"]"%{$reset_color%}"
|
||||
if [[ -n $CRUNCH_RUBY_VERSION ]]; then
|
||||
CRUNCH_RUBY_="$CRUNCH_BRACKET_COLOR"["$CRUNCH_RVM_COLOR$CRUNCH_RUBY_VERSION$CRUNCH_BRACKET_COLOR"]"%{$reset_color%}"
|
||||
fi
|
||||
CRUNCH_DIR_="$CRUNCH_DIR_COLOR%~\$(git_prompt_info) "
|
||||
CRUNCH_PROMPT="$CRUNCH_BRACKET_COLOR➭ "
|
||||
|
||||
# Put it all together!
|
||||
PROMPT="$CRUNCH_TIME_$CRUNCH_RVM_$CRUNCH_DIR_$CRUNCH_PROMPT%{$reset_color%}"
|
||||
PROMPT="$CRUNCH_TIME_$CRUNCH_RUBY_$CRUNCH_DIR_$CRUNCH_PROMPT%{$reset_color%}"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue