From fae42395f559870a32574e897f3bc6eda2a98d8c Mon Sep 17 00:00:00 2001 From: Wes Morgan Date: Tue, 23 Oct 2012 11:11:27 -0600 Subject: [PATCH 1/2] support rbenv version in skwp prompt --- zsh/prezto-themes/prompt_skwp_setup | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/zsh/prezto-themes/prompt_skwp_setup b/zsh/prezto-themes/prompt_skwp_setup index 27b48963..153bbec8 100644 --- a/zsh/prezto-themes/prompt_skwp_setup +++ b/zsh/prezto-themes/prompt_skwp_setup @@ -1,6 +1,6 @@ # # A theme based on steeef theme -# * RVM info shown on the right +# * RVM/Rbenv info shown on the right # * Git branch info on the left # * Single line prompt # @@ -15,9 +15,11 @@ function rvm_info_for_prompt { if [[ -d ~/.rvm/ ]]; then ruby_version=$(~/.rvm/bin/rvm-prompt) - if [ -n "$ruby_version" ]; then - echo "[$ruby_version]" - fi + elif [[ -d ~/.rbenv/ ]]; then + ruby_version=$(<~/.rbenv/version) + fi + if [ -n "$ruby_version" ]; then + echo "[$ruby_version]" fi } From 8812584047272fa07e8c867af7c6c49fe1c8d572 Mon Sep 17 00:00:00 2001 From: Wes Morgan Date: Tue, 23 Oct 2012 11:58:50 -0600 Subject: [PATCH 2/2] ask rbenv for current version instead of reading rbenv/version file --- zsh/prezto-themes/prompt_skwp_setup | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/zsh/prezto-themes/prompt_skwp_setup b/zsh/prezto-themes/prompt_skwp_setup index 153bbec8..17b4d7e8 100644 --- a/zsh/prezto-themes/prompt_skwp_setup +++ b/zsh/prezto-themes/prompt_skwp_setup @@ -15,11 +15,14 @@ function rvm_info_for_prompt { if [[ -d ~/.rvm/ ]]; then ruby_version=$(~/.rvm/bin/rvm-prompt) + if [ -n "$ruby_version" ]; then + echo "[$ruby_version]" + fi elif [[ -d ~/.rbenv/ ]]; then - ruby_version=$(<~/.rbenv/version) - fi - if [ -n "$ruby_version" ]; then - echo "[$ruby_version]" + ruby_version=(${(s: :)$(rbenv version)}) + if [ -n "$ruby_version" ]; then + echo "[${ruby_version[1]}]" + fi fi }