summaryrefslogtreecommitdiff
path: root/powerlevel9k.zsh-theme
diff options
context:
space:
mode:
authorBen Hilburn <bhilburn@gmail.com>2016-02-21 02:28:44 +0300
committerBen Hilburn <bhilburn@gmail.com>2016-02-21 02:28:44 +0300
commite93d053035e54a50f85ac78377e98dbf0d15e75e (patch)
tree10dcdc710fda65abc50b60c4437a7f79101d5cf7 /powerlevel9k.zsh-theme
parent94c87a4d239f770346e510adf46e5844e9023b99 (diff)
parent01bdee42a21b797d2d7e0b0c032d30e23e1499c9 (diff)
Merge pull request #216 from natemccurdy/issues/215
Improve the rbenv prompt by using `version-name`
Diffstat (limited to 'powerlevel9k.zsh-theme')
-rwxr-xr-xpowerlevel9k.zsh-theme12
1 files changed, 10 insertions, 2 deletions
diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme
index 59733acd..590dc300 100755
--- a/powerlevel9k.zsh-theme
+++ b/powerlevel9k.zsh-theme
@@ -605,8 +605,16 @@ prompt_ram() {
# rbenv information
prompt_rbenv() {
- if [[ -n "$RBENV_VERSION" ]]; then
- "$1_prompt_segment" "$0" "$2" "red" "$DEFAULT_COLOR" "$RBENV_VERSION" 'RUBY_ICON'
+ 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
+ fi
+
+ "$1_prompt_segment" "$0" "$2" "red" "$DEFAULT_COLOR" "$rbenv_version_name" 'RUBY_ICON'
fi
}