diff options
author | Ben Hilburn <bhilburn@gmail.com> | 2016-03-05 23:36:57 +0300 |
---|---|---|
committer | Ben Hilburn <bhilburn@gmail.com> | 2016-03-05 23:36:57 +0300 |
commit | 38b4d52e9063566033f540943dbcbc90783c5b10 (patch) | |
tree | b4d3a2c2e7946764e7f4aa7da91672e9b02d45da | |
parent | 4f0c3ffdf838955741894b52fab6b41d312ab167 (diff) | |
parent | 88fd11a8657eaefa5477d07538dbbbc24b905d2c (diff) |
Merge pull request #228 from wadkar/next_chruby_prompt
Add chruby prompt segment.
-rw-r--r-- | README.md | 3 | ||||
-rwxr-xr-x | powerlevel9k.zsh-theme | 11 |
2 files changed, 13 insertions, 1 deletions
@@ -100,7 +100,8 @@ The segments that are currently available are: * **os_icon** - Display a nice little icon, depending on your operating system. * **php_version** - Show the current PHP version. * **ram** - Show free RAM -* [rbenv](#rbenv) - Ruby environment information (if one is active). +* [rbenv](#rbenv) - Ruby environment information using `rbenv` (if one is active). +* [chruby](#chruby) - Ruby environment information using `chruby` (if one is active; also, see postmodern/chruby#245 for issue with auto switching of ruby). * **root_indicator** - An indicator if the user is root. * [rspec_stats](#rspec_stats) - Show a ratio of test classes vs code classes for RSpec. * **rust_version** - Display the current rust version. diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index 72d37318..2ef4fe3c 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -622,6 +622,17 @@ prompt_rbenv() { fi } +# chruby information +# see https://github.com/postmodern/chruby/issues/245 for chruby_auto issue with ZSH +prompt_chruby() { + local chruby_env + chrb_env="$(chruby 2> /dev/null | grep \* | tr -d '* ')" + # Don't show anything if the chruby did not change the default ruby + if [[ "${chrb_env:-system}" != "system" ]]; then + "$1_prompt_segment" "$0" "$2" "red" "$DEFAULT_COLOR" "${chrb_env}" 'RUBY_ICON' + fi +} + # Print an icon if user is root. prompt_root_indicator() { if [[ "$UID" -eq 0 ]]; then |