From 937cbbb8a5b2869f53f91d3ca7fb4f1265982f68 Mon Sep 17 00:00:00 2001 From: Juan Swan Date: Tue, 14 Jun 2022 19:07:09 -0500 Subject: [PATCH 1/4] themes/sirup: Show VirtualEnv Added the ability to show the current Virtual Env when using Python Virtual Env. If there's not vitual env, the theme works normal. --- themes/sirup/sirup.theme.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/themes/sirup/sirup.theme.sh b/themes/sirup/sirup.theme.sh index 14cbfb840..39ab0ed86 100644 --- a/themes/sirup/sirup.theme.sh +++ b/themes/sirup/sirup.theme.sh @@ -2,6 +2,16 @@ # For unstaged(*) and staged(+) values next to branch name in __git_ps1 GIT_PS1_SHOWDIRTYSTATE="enabled" +function omb_theme_syrup_python_venv { + local python_venv="" + + if [[ -n "${VIRTUAL_ENV}" ]]; then + python_venv=$(basename "${VIRTUAL_ENV}") + fi + + [[ -n "${python_venv}" ]] && echo "[${python_venv}] " +} + function _omb_theme_sirup_rubygem { local gemset=$(command awk -F'@' '{print $2}' <<< "$GEM_HOME") [[ $gemset ]] && gemset="@$gemset" @@ -15,7 +25,7 @@ function _omb_theme_sirup_rubygem { function _omb_theme_PROMPT_COMMAND { # Check http://github.com/Sirupsen/dotfiles for screenshot - PS1="$_omb_prompt_navy\W/$_omb_prompt_bold_navy$(_omb_theme_sirup_rubygem)$_omb_prompt_bold_green$(__git_ps1 " (%s)") ${_omb_prompt_normal}$ " + PS1="$_omb_prompt_purple$(omb_theme_syrup_python_venv)$_omb_prompt_navy\W/$_omb_prompt_bold_navy$(_omb_theme_sirup_rubygem)$_omb_prompt_bold_green$(__git_ps1 " (%s)") ${_omb_prompt_normal}$ " } _omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND From 09d7b5a639d80efbdda373fd98f5e9e8d88c864e Mon Sep 17 00:00:00 2001 From: Koichi Murase Date: Thu, 23 Jun 2022 10:24:11 +0900 Subject: [PATCH 2/4] themes/sirup: Use an existing utility for python_venv --- themes/sirup/sirup.theme.sh | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/themes/sirup/sirup.theme.sh b/themes/sirup/sirup.theme.sh index 39ab0ed86..a43ae1c4c 100644 --- a/themes/sirup/sirup.theme.sh +++ b/themes/sirup/sirup.theme.sh @@ -1,16 +1,8 @@ #! bash oh-my-bash.module # For unstaged(*) and staged(+) values next to branch name in __git_ps1 GIT_PS1_SHOWDIRTYSTATE="enabled" - -function omb_theme_syrup_python_venv { - local python_venv="" - - if [[ -n "${VIRTUAL_ENV}" ]]; then - python_venv=$(basename "${VIRTUAL_ENV}") - fi - - [[ -n "${python_venv}" ]] && echo "[${python_venv}] " -} +OMB_PROMPT_VIRTUALENV_FORMAT='[%s] ' +OMB_PROMPT_CONDAENV_FORMAT='[%s] ' function _omb_theme_sirup_rubygem { local gemset=$(command awk -F'@' '{print $2}' <<< "$GEM_HOME") @@ -25,7 +17,9 @@ function _omb_theme_sirup_rubygem { function _omb_theme_PROMPT_COMMAND { # Check http://github.com/Sirupsen/dotfiles for screenshot - PS1="$_omb_prompt_purple$(omb_theme_syrup_python_venv)$_omb_prompt_navy\W/$_omb_prompt_bold_navy$(_omb_theme_sirup_rubygem)$_omb_prompt_bold_green$(__git_ps1 " (%s)") ${_omb_prompt_normal}$ " + local python_venv + _omb_prompt_get_python_venv + PS1="$_omb_prompt_purple$python_venv$_omb_prompt_navy\W/$_omb_prompt_bold_navy$(_omb_theme_sirup_rubygem)$_omb_prompt_bold_green$(__git_ps1 " (%s)") ${_omb_prompt_normal}$ " } _omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND From b991b94cab5cec39190f3ab225fe8ab2bfd7ea70 Mon Sep 17 00:00:00 2001 From: Koichi Murase Date: Sun, 12 Feb 2023 15:35:05 +0900 Subject: [PATCH 3/4] themes/sirup: Support OMB_PROMPT_SHOW_PYTHON_VENV --- themes/sirup/sirup.theme.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/themes/sirup/sirup.theme.sh b/themes/sirup/sirup.theme.sh index a43ae1c4c..5fef1a8a7 100644 --- a/themes/sirup/sirup.theme.sh +++ b/themes/sirup/sirup.theme.sh @@ -3,6 +3,7 @@ GIT_PS1_SHOWDIRTYSTATE="enabled" OMB_PROMPT_VIRTUALENV_FORMAT='[%s] ' OMB_PROMPT_CONDAENV_FORMAT='[%s] ' +OMB_PROMPT_SHOW_PYTHON_VENV=${OMB_PROMPT_SHOW_PYTHON_VENV:=false} function _omb_theme_sirup_rubygem { local gemset=$(command awk -F'@' '{print $2}' <<< "$GEM_HOME") From 71d9a1b7dac65c7bcda07f0befb0d8b04ac472d4 Mon Sep 17 00:00:00 2001 From: Koichi Murase Date: Sun, 12 Feb 2023 15:41:57 +0900 Subject: [PATCH 4/4] themes/sirup: Move segment "python_venv" next to segment "ruby_gem" --- themes/sirup/sirup.theme.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/themes/sirup/sirup.theme.sh b/themes/sirup/sirup.theme.sh index 5fef1a8a7..b1d8a922d 100644 --- a/themes/sirup/sirup.theme.sh +++ b/themes/sirup/sirup.theme.sh @@ -1,8 +1,8 @@ #! bash oh-my-bash.module # For unstaged(*) and staged(+) values next to branch name in __git_ps1 GIT_PS1_SHOWDIRTYSTATE="enabled" -OMB_PROMPT_VIRTUALENV_FORMAT='[%s] ' -OMB_PROMPT_CONDAENV_FORMAT='[%s] ' +OMB_PROMPT_VIRTUALENV_FORMAT=' [%s]' +OMB_PROMPT_CONDAENV_FORMAT=' [%s]' OMB_PROMPT_SHOW_PYTHON_VENV=${OMB_PROMPT_SHOW_PYTHON_VENV:=false} function _omb_theme_sirup_rubygem { @@ -20,7 +20,7 @@ function _omb_theme_PROMPT_COMMAND { # Check http://github.com/Sirupsen/dotfiles for screenshot local python_venv _omb_prompt_get_python_venv - PS1="$_omb_prompt_purple$python_venv$_omb_prompt_navy\W/$_omb_prompt_bold_navy$(_omb_theme_sirup_rubygem)$_omb_prompt_bold_green$(__git_ps1 " (%s)") ${_omb_prompt_normal}$ " + PS1="$_omb_prompt_navy\W/$_omb_prompt_bold_navy$(_omb_theme_sirup_rubygem)$_omb_prompt_bold_purple$python_venv$_omb_prompt_bold_green$(__git_ps1 " (%s)") ${_omb_prompt_normal}$ " } _omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND