mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-02-13 03:01:32 +01:00
Add chruby support to superjarin prompt, making it definitively the best prompt
This commit is contained in:
parent
eafd5f3252
commit
8315d473f4
1 changed files with 22 additions and 2 deletions
|
|
@ -1,9 +1,29 @@
|
|||
# Grab the current version of ruby in use (via RVM): [ruby-1.8.7]
|
||||
if [ -e ~/.rvm/bin/rvm-prompt ]; then
|
||||
# Grab the current version of ruby in use: [ruby-1.8.7]
|
||||
if [ -s ~/.rvm/scripts/rvm ]; then
|
||||
JARIN_CURRENT_RUBY_="%{$fg[white]%}[%{$fg[red]%}\$(~/.rvm/bin/rvm-prompt i v)%{$fg[white]%}]%{$reset_color%}"
|
||||
else
|
||||
if which rbenv &> /dev/null; then
|
||||
JARIN_CURRENT_RUBY_="%{$fg[white]%}[%{$fg[red]%}\$(rbenv version | sed -e 's/ (set.*$//')%{$fg[white]%}]%{$reset_color%}"
|
||||
else
|
||||
# Loosely adapted from the oh-my-zsh chruby plugin
|
||||
#
|
||||
# NOTE: If you're using chruby auto-switching, your .zshrc needs to have this:
|
||||
#
|
||||
# source /usr/local/opt/chruby/share/chruby/chruby.sh
|
||||
# source /usr/local/opt/chruby/share/chruby/auto.sh
|
||||
# precmd_functions+=("chruby_auto")
|
||||
#
|
||||
# It's because the auto thingy is evaluated after the prompt thingy.
|
||||
|
||||
if which chruby &> /dev/null; then
|
||||
if [[ $(chruby |grep -c \*) -eq 1 ]]; then
|
||||
_ruby="$(chruby |grep \* |tr -d '* ')"
|
||||
else
|
||||
_ruby="system"
|
||||
fi
|
||||
|
||||
JARIN_CURRENT_RUBY_="%{$fg[white]%}[%{$fg[red]%}$_ruby%{$fg[white]%}]%{$reset_color%}"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue