diff options
author | Ben Hilburn <bhilburn@gmail.com> | 2017-09-29 00:30:03 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-29 00:30:03 +0300 |
commit | 9ab067bd6229ea776728604c3fc6802e6059562f (patch) | |
tree | 52baa1ed2f9cf9d4479bb0c8763e80ea347eb5a7 | |
parent | 50f0a94642222e62fc30f7f3f2e487ad962210c7 (diff) | |
parent | 748f9868fcf275a12359d23433191118ff690489 (diff) |
Merge pull request #610 from sjoeboo/rbenv_always
Add ability to always show rbenv prompt
-rw-r--r-- | README.md | 6 | ||||
-rwxr-xr-x | powerlevel9k.zsh-theme | 10 |
2 files changed, 10 insertions, 6 deletions
@@ -509,7 +509,11 @@ This segment shows the version of Ruby being used when using `rbenv` to change y It figures out the version being used by taking the output of the `rbenv version-name` command. * If `rbenv` is not in $PATH, nothing will be shown. -* If the current Ruby version is the same as the global Ruby version, nothing will be shown. +* By default, if the current local Ruby version is the same as the global Ruby version, nothing will be shown. See the configuration variable, below, to modify this behavior. + +Variable | Default Value | Description | +|----------|---------------|-------------| +|`POWERLEVEL9K_RBENV_ALWAYS`|'false'|Always show the `rbenv` segment, even if the local version matches the global.| ##### rspec_stats diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index b03a9374..148ffeab 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -1052,17 +1052,17 @@ prompt_ram() { } # rbenv information +set_default POWERLEVEL9K_RBENV_ALWAYS false prompt_rbenv() { if which rbenv 2>/dev/null >&2; then local rbenv_version_name="$(rbenv version-name)" local rbenv_global="$(rbenv global)" - # Don't show anything if the current Ruby is the same as the global Ruby. - if [[ $rbenv_version_name == $rbenv_global ]]; then - return + # Don't show anything if the current Ruby is the same as the global Ruby + # unless `POWERLEVEL9K_RBENV_ALWAYS` is set. + if [[ $POWERLEVEL9K_RBENV_ALWAYS == true || $rbenv_version_name != $rbenv_global ]];then + "$1_prompt_segment" "$0" "$2" "red" "$DEFAULT_COLOR" "$rbenv_version_name" 'RUBY_ICON' fi - - "$1_prompt_segment" "$0" "$2" "red" "$DEFAULT_COLOR" "$rbenv_version_name" 'RUBY_ICON' fi } |