From 26f48b030d4ef5ed32c443c97c103f601e76cca7 Mon Sep 17 00:00:00 2001 From: Koichi Murase Date: Thu, 16 Feb 2023 14:17:59 +0900 Subject: [PATCH] themes/rr: Refactor using OMB_PROMPT_VIRTUALENV_FORMAT --- themes/rr/rr.theme.sh | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/themes/rr/rr.theme.sh b/themes/rr/rr.theme.sh index 83d4650..92b82a4 100644 --- a/themes/rr/rr.theme.sh +++ b/themes/rr/rr.theme.sh @@ -9,7 +9,12 @@ # # Configuration. Change these by adding them in your .bash_profile +OMB_PROMPT_SHOW_PYTHON_VENV=${OMB_PROMPT_SHOW_PYTHON_VENV:=false} +OMB_PROMPT_VIRTUALENV_FORMAT="${_omb_prompt_bold_purple}vitualenv:(${_omb_prompt_reset_color}%s${_omb_prompt_bold_purple}) ${_omb_prompt_reset_color}" +OMB_PROMPT_CONDAENV_FORMAT="${_omb_prompt_bold_purple}condaenv:(${_omb_prompt_reset_color}%s${_omb_prompt_bold_purple}) ${_omb_prompt_reset_color}" + function _omb_theme_PROMPT_COMMAND() { + local arrow="${_omb_prompt_bold_purple}➜${_omb_prompt_reset_color}" local user_name="${_omb_prompt_white}\u${_omb_prompt_reset_color}" local base_directory="${_omb_prompt_bold_blue}\W${_omb_prompt_reset_color}" local GIT_THEME_PROMPT_PREFIX="${_omb_prompt_bold_purple}git:(${_omb_prompt_reset_color}" @@ -18,20 +23,16 @@ function _omb_theme_PROMPT_COMMAND() { local SCM_THEME_PROMPT_SUFFIX="${_omb_prompt_bold_purple})${_omb_prompt_reset_color}" local SCM_THEME_PROMPT_CLEAN="${_omb_prompt_bold_green} ✓${_omb_prompt_reset_color}" local SCM_THEME_PROMPT_DIRTY="${_omb_prompt_bold_red} ✗${_omb_prompt_reset_color}" - local arrow="${_omb_prompt_bold_purple}➜${_omb_prompt_reset_color}" PS1="${arrow} ${user_name} ${base_directory} " - local VIRTUALENV_THEME_PROMPT_PREFIX="${_omb_prompt_bold_purple}vitualenv:(${_omb_prompt_reset_color}" - local VIRTUALENV_THEME_PROMPT_SUFFIX="${_omb_prompt_bold_purple}) ${_omb_prompt_reset_color}" - local python_venv; _omb_prompt_get_python_venv - - PS1+=${python_venv} + local python_venv + _omb_prompt_get_python_venv + PS1+=$python_venv local scm_info=$(scm_prompt_info) - PS1+=${scm_info:+$scm_info } - PS1+=${_omb_prompt_normal} + PS1+=$_omb_prompt_normal } _omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND