mirror of
https://github.com/Cornelicorn/bullet-train.zsh.git
synced 2025-12-06 11:50:38 +01:00
Merge pull request #58 from vadviktor/vadviktor-patch-unified-ruby
Adding Rbenv support for RVM branch
This commit is contained in:
12
README.md
12
README.md
@@ -13,7 +13,7 @@ simplicity, showing information only when it's relevant.
|
||||
|
||||
It currently shows:
|
||||
- Current Python virtualenv
|
||||
- Current Ruby version and gemset, through RVM
|
||||
- Current Ruby version using Rbenv; version and gemset when on RVM
|
||||
- Current Node.js version, through NVM
|
||||
- Git status
|
||||
- Timestamp
|
||||
@@ -154,14 +154,14 @@ or don't want to see. All options must be overridden in your **.zshrc** file.
|
||||
|`BULLETTRAIN_NVM_FG`|`white`|Foreground color
|
||||
|`BULLETTRAIN_NVM_PREFIX`|`"⬡ "`|Prefix of the segment
|
||||
|
||||
### Ruby RVM
|
||||
### Ruby RVM/Rbenv
|
||||
|
||||
|Variable|Default|Meaning
|
||||
|--------|-------|-------|
|
||||
|`BULLETTRAIN_RVM_SHOW`|`true`|Show/hide that segment
|
||||
|`BULLETTRAIN_RVM_BG`|`magenta`|Background color
|
||||
|`BULLETTRAIN_RVM_FG`|`white`|Foreground color
|
||||
|`BULLETTRAIN_RVM_PREFIX`|`"♦"`|Prefix of the segment
|
||||
|`BULLETTRAIN_RUBY_SHOW`|`true`|Show/hide that segment
|
||||
|`BULLETTRAIN_RUBY_BG`|`magenta`|Background color
|
||||
|`BULLETTRAIN_RUBY_FG`|`white`|Foreground color
|
||||
|`BULLETTRAIN_RUBY_PREFIX`|`"♦"`|Prefix of the segment
|
||||
|
||||
### Dir
|
||||
|
||||
|
||||
@@ -79,18 +79,18 @@ if [ ! -n "${BULLETTRAIN_NVM_PREFIX+1}" ]; then
|
||||
BULLETTRAIN_NVM_PREFIX="⬡ "
|
||||
fi
|
||||
|
||||
# RMV
|
||||
if [ ! -n "${BULLETTRAIN_RVM_SHOW+1}" ]; then
|
||||
BULLETTRAIN_RVM_SHOW=true
|
||||
# RUBY
|
||||
if [ ! -n "${BULLETTRAIN_RUBY_SHOW+1}" ]; then
|
||||
BULLETTRAIN_RUBY_SHOW=true
|
||||
fi
|
||||
if [ ! -n "${BULLETTRAIN_RVM_BG+1}" ]; then
|
||||
BULLETTRAIN_RVM_BG=magenta
|
||||
if [ ! -n "${BULLETTRAIN_RUBY_BG+1}" ]; then
|
||||
BULLETTRAIN_RUBY_BG=magenta
|
||||
fi
|
||||
if [ ! -n "${BULLETTRAIN_RVM_FG+1}" ]; then
|
||||
BULLETTRAIN_RVM_FG=white
|
||||
if [ ! -n "${BULLETTRAIN_RUBY_FG+1}" ]; then
|
||||
BULLETTRAIN_RUBY_FG=white
|
||||
fi
|
||||
if [ ! -n "${BULLETTRAIN_RVM_PREFIX+1}" ]; then
|
||||
BULLETTRAIN_RVM_PREFIX=♦️
|
||||
if [ ! -n "${BULLETTRAIN_RUBY_PREFIX+1}" ]; then
|
||||
BULLETTRAIN_RUBY_PREFIX=♦️
|
||||
fi
|
||||
|
||||
# DIR
|
||||
@@ -334,17 +334,21 @@ prompt_dir() {
|
||||
prompt_segment $BULLETTRAIN_DIR_BG $BULLETTRAIN_DIR_FG $dir
|
||||
}
|
||||
|
||||
# RVM: only shows RVM info if on a gemset that is not the default one
|
||||
prompt_rvm() {
|
||||
if [[ $BULLETTRAIN_RVM_SHOW == false ]] then
|
||||
# RUBY
|
||||
# RVM: only shows RUBY info if on a gemset that is not the default one
|
||||
# RBENV: shows current ruby version active in the shell
|
||||
prompt_ruby() {
|
||||
if [[ $BULLETTRAIN_RUBY_SHOW == false ]] then
|
||||
return
|
||||
fi
|
||||
|
||||
if which rvm-prompt &> /dev/null; then
|
||||
if [[ ! -n $(rvm gemset list | grep "=> (default)") ]]
|
||||
then
|
||||
prompt_segment $BULLETTRAIN_RVM_BG $BULLETTRAIN_RVM_FG $BULLETTRAIN_RVM_PREFIX" $(rvm-prompt i v g)"
|
||||
prompt_segment $BULLETTRAIN_RUBY_BG $BULLETTRAIN_RUBY_FG $BULLETTRAIN_RUBY_PREFIX" $(rvm-prompt i v g)"
|
||||
fi
|
||||
elif which rbenv &> /dev/null; then
|
||||
prompt_segment $BULLETTRAIN_RUBY_BG $BULLETTRAIN_RUBY_FG $BULLETTRAIN_RUBY_PREFIX" $(rbenv version | sed -e 's/ (set.*$//')"
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -435,7 +439,7 @@ build_prompt() {
|
||||
RETVAL=$?
|
||||
prompt_time
|
||||
prompt_status
|
||||
prompt_rvm
|
||||
prompt_ruby
|
||||
prompt_virtualenv
|
||||
prompt_nvm
|
||||
prompt_context
|
||||
|
||||
Reference in New Issue
Block a user