zsh modified to reflect rbenv

This commit is contained in:
michi
2014-02-10 23:01:24 +01:00
parent 140897dc65
commit 01a97c50e6
3 changed files with 20 additions and 4 deletions

View File

@@ -61,3 +61,13 @@ function extract() {
fi
}
function ruby_version()
{
if which rvm-prompt &> /dev/null; then
rvm-prompt i v g
else
if which rbenv &> /dev/null; then
rbenv version | sed -e "s/ (set.*$//"
fi
fi
}

View File

@@ -15,10 +15,12 @@ $(virtualenv_info)$(prompt_char) '
#RPROMPT='[%T]'
#RVM settings
if [[ -s ~/.rvm/scripts/rvm ]] ; then
RPROMPT='[%T] %{$fg[yellow]%}rvm: %{$reset_color%}%{$fg[red]%}$(~/.rvm/bin/rvm-prompt)%{$reset_color%}'
else
RPROMPT='[%T]'
if which rvm-prompt &> /dev/null; then
RPROMPT='[%T] %{$fg[yellow]%}rvm: %{$reset_color%}%{$fg[red]%}$(ruby_version)%{$reset_color%}'
elif which rbenv &> /dev/null; then
RPROMPT='[%T] %{$fg[yellow]%}rbenv: %{$reset_color%}%{$fg[red]%}$(ruby_version)%{$reset_color%}'
else
RPROMPT='[%T]'
fi
ZSH_THEME_GIT_PROMPT_PREFIX=" on %{$fg[yellow]%}"

4
zshrc
View File

@@ -12,6 +12,10 @@ ulimit -Sn 2048
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
# rbenv
export RBENV_ROOT=/usr/local/var/rbenv
eval "$(rbenv init -)"
PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
PATH=/usr/local/bin:$PATH
PATH=/usr/local/bin:/usr/local/sbin:$PATH # Added for more brew executables