From 5dd75d3fd9e9cd5f58482fb3dd2987c5e64287cb Mon Sep 17 00:00:00 2001 From: Mike Matz Date: Tue, 26 Apr 2016 07:25:35 -0700 Subject: [PATCH 1/2] Add virtualenv to pure theme --- themes/pure/pure.theme.bash | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/themes/pure/pure.theme.bash b/themes/pure/pure.theme.bash index b75d3f8f..e9c222e6 100644 --- a/themes/pure/pure.theme.bash +++ b/themes/pure/pure.theme.bash @@ -31,11 +31,18 @@ pure_prompt() { ps_root_mark="${red} # ${normal}" ps_path="${yellow}\w${normal}"; + # Virtualenv + if [[ $VIRTUAL_ENV != "" ]]; then + venv="(${VIRTUAL_ENV##*/})" + else + venv="" + fi + # make it work case $(id -u) in - 0) PS1="$ps_root@$ps_host$(scm_prompt):$ps_path$ps_root_mark" + 0) PS1="${venv}$ps_root@$ps_host$(scm_prompt):$ps_path$ps_root_mark" ;; - *) PS1="$ps_user@$ps_host$(scm_prompt):$ps_path$ps_user_mark" + *) PS1="${venv}$ps_user@$ps_host$(scm_prompt):$ps_path$ps_user_mark" ;; esac } From 18364434ca3986b86954de2d464797f9f373abae Mon Sep 17 00:00:00 2001 From: Mike Matz Date: Mon, 10 Apr 2017 07:08:23 -0700 Subject: [PATCH 2/2] Use virtualenv_prompt from base.theme.bash --- themes/pure/pure.theme.bash | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/themes/pure/pure.theme.bash b/themes/pure/pure.theme.bash index e9c222e6..c18e20b2 100644 --- a/themes/pure/pure.theme.bash +++ b/themes/pure/pure.theme.bash @@ -8,6 +8,9 @@ SCM_GIT_CHAR="${green}±${normal}" SCM_SVN_CHAR="${bold_cyan}⑆${normal}" SCM_HG_CHAR="${bold_red}☿${normal}" +VIRTUALENV_THEME_PROMPT_PREFIX="(" +VIRTUALENV_THEME_PROMPT_SUFFIX=")" + ### TODO: openSUSE has already colors enabled, check if those differs from stock # LS colors, made with http://geoff.greer.fm/lscolors/ # export LSCOLORS="Gxfxcxdxbxegedabagacad" @@ -31,18 +34,11 @@ pure_prompt() { ps_root_mark="${red} # ${normal}" ps_path="${yellow}\w${normal}"; - # Virtualenv - if [[ $VIRTUAL_ENV != "" ]]; then - venv="(${VIRTUAL_ENV##*/})" - else - venv="" - fi - # make it work case $(id -u) in - 0) PS1="${venv}$ps_root@$ps_host$(scm_prompt):$ps_path$ps_root_mark" + 0) PS1="$(virtualenv_prompt)$ps_root@$ps_host$(scm_prompt):$ps_path$ps_root_mark" ;; - *) PS1="${venv}$ps_user@$ps_host$(scm_prompt):$ps_path$ps_user_mark" + *) PS1="$(virtualenv_prompt)$ps_user@$ps_host$(scm_prompt):$ps_path$ps_user_mark" ;; esac }