From 76fb7a258be3cfd21d2e03a5c612b6d3bce18eca Mon Sep 17 00:00:00 2001 From: chieping Date: Wed, 4 Mar 2020 09:21:02 +0100 Subject: [PATCH] rbenv: fix rbenv_prompt_info prefix and suffix (#3764) Closes #3764 --- plugins/rbenv/rbenv.plugin.zsh | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/plugins/rbenv/rbenv.plugin.zsh b/plugins/rbenv/rbenv.plugin.zsh index ed46d355b..b446b6363 100644 --- a/plugins/rbenv/rbenv.plugin.zsh +++ b/plugins/rbenv/rbenv.plugin.zsh @@ -47,11 +47,10 @@ if [[ $FOUND_RBENV -eq 1 ]]; then } function rbenv_prompt_info() { - if [[ -n $(current_gemset) ]] ; then - echo "$(current_ruby)@$(current_gemset)" - else - echo "$(current_ruby)" - fi + local ruby=$(current_ruby) gemset=$(current_gemset) + echo -n "${ZSH_THEME_RUBY_PROMPT_PREFIX}" + [[ -n "$gemset" ]] && echo -n "${ruby}@${gemset}" || echo -n "${ruby}" + echo "${ZSH_THEME_RUBY_PROMPT_SUFFIX}" } else alias rubies="ruby -v" @@ -59,7 +58,11 @@ else function current_ruby() { echo "not supported" } function current_gemset() { echo "not supported" } function gems() { echo "not supported" } - function rbenv_prompt_info() { echo "system: $(ruby -v | cut -f-2 -d ' ')" } + function rbenv_prompt_info() { + echo -n "${ZSH_THEME_RUBY_PROMPT_PREFIX}" + echo -n "system: $(ruby -v | cut -f-2 -d ' ')" + echo "${ZSH_THEME_RUBY_PROMPT_SUFFIX}" + } fi unset FOUND_RBENV rbenvdirs dir