mirror of
https://github.com/ohmybash/oh-my-bash.git
synced 2024-09-21 10:27:09 +00:00
themes/robbyrussell: Add Python Virtual environment indicator (#536)
Co-authored-by: programmer <programmer@debian.debian>
This commit is contained in:
parent
aa5deb804c
commit
4c2afd012a
@ -3,13 +3,29 @@
|
|||||||
# This theme attempts to replicate the default "robbyrussell" theme from ohmyzsh:
|
# This theme attempts to replicate the default "robbyrussell" theme from ohmyzsh:
|
||||||
# https://github.com/ohmyzsh/ohmyzsh/blob/master/themes/robbyrussell.zsh-theme
|
# https://github.com/ohmyzsh/ohmyzsh/blob/master/themes/robbyrussell.zsh-theme
|
||||||
|
|
||||||
|
# Example outside git repo:
|
||||||
|
# ➜ ~
|
||||||
|
# Example inside clean git repo:
|
||||||
|
# ➜ config-files git:(main)
|
||||||
|
# Example inside dirty git repo:
|
||||||
|
# ➜ config-files git:(main ?:1) ✗
|
||||||
|
# Example with virtual environment:
|
||||||
|
# ➜ (env1) ~
|
||||||
|
# Example with virtual environment and inside git repo:
|
||||||
|
# ➜ (env1) config-files git:(main)
|
||||||
|
# python_venv setup
|
||||||
|
OMB_PROMPT_VIRTUALENV_FORMAT='(%s) '
|
||||||
|
OMB_PROMPT_SHOW_PYTHON_VENV=${OMB_PROMPT_SHOW_PYTHON_VENV:=true}
|
||||||
|
|
||||||
function _omb_theme_PROMPT_COMMAND() {
|
function _omb_theme_PROMPT_COMMAND() {
|
||||||
if [[ "$?" == 0 ]]; then
|
if [[ "$?" == 0 ]]; then
|
||||||
local arrow_color="${_omb_prompt_bold_green}"
|
local arrow_color="${_omb_prompt_bold_green}"
|
||||||
else
|
else
|
||||||
local arrow_color="${_omb_prompt_bold_brown}"
|
local arrow_color="${_omb_prompt_bold_brown}"
|
||||||
fi
|
fi
|
||||||
|
# set the python_venv format
|
||||||
|
local python_venv; _omb_prompt_get_python_venv
|
||||||
|
python_venv="$_omb_prompt_olive$python_venv"
|
||||||
local base_directory="${_omb_prompt_bold_teal}\W${_omb_prompt_reset_color}"
|
local base_directory="${_omb_prompt_bold_teal}\W${_omb_prompt_reset_color}"
|
||||||
local GIT_THEME_PROMPT_PREFIX="${_omb_prompt_bold_navy}git:(${_omb_prompt_bold_brown}"
|
local GIT_THEME_PROMPT_PREFIX="${_omb_prompt_bold_navy}git:(${_omb_prompt_bold_brown}"
|
||||||
local SVN_THEME_PROMPT_PREFIX="${_omb_prompt_bold_navy}svn:(${_omb_prompt_bold_brown}"
|
local SVN_THEME_PROMPT_PREFIX="${_omb_prompt_bold_navy}svn:(${_omb_prompt_bold_brown}"
|
||||||
@ -17,10 +33,9 @@ function _omb_theme_PROMPT_COMMAND() {
|
|||||||
local SCM_THEME_PROMPT_SUFFIX="${_omb_prompt_reset_color}"
|
local SCM_THEME_PROMPT_SUFFIX="${_omb_prompt_reset_color}"
|
||||||
local SCM_THEME_PROMPT_CLEAN="${_omb_prompt_bold_navy})${_omb_prompt_reset_color}"
|
local SCM_THEME_PROMPT_CLEAN="${_omb_prompt_bold_navy})${_omb_prompt_reset_color}"
|
||||||
local SCM_THEME_PROMPT_DIRTY="${_omb_prompt_bold_navy}) ${_omb_prompt_olive}✗${_omb_prompt_reset_color}"
|
local SCM_THEME_PROMPT_DIRTY="${_omb_prompt_bold_navy}) ${_omb_prompt_olive}✗${_omb_prompt_reset_color}"
|
||||||
|
|
||||||
local arrow="${arrow_color}➜${_omb_prompt_reset_color}"
|
local arrow="${arrow_color}➜${_omb_prompt_reset_color}"
|
||||||
|
|
||||||
PS1="${arrow} ${base_directory} "
|
PS1="${arrow} ${python_venv}${base_directory} "
|
||||||
|
|
||||||
local scm_info=$(scm_prompt_info)
|
local scm_info=$(scm_prompt_info)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user