context factorization
This commit is contained in:
@@ -660,30 +660,18 @@ set_prompt()
|
|||||||
_venv_env="$(_prompt_venv_env)"
|
_venv_env="$(_prompt_venv_env)"
|
||||||
_session_tags="$(_prompt_session_markers)"
|
_session_tags="$(_prompt_session_markers)"
|
||||||
|
|
||||||
if [[ -n "$_git_seg" ]]; then
|
local _ctx_disp
|
||||||
_ctx="$_git_seg"
|
_ctx_disp()
|
||||||
fi
|
{
|
||||||
if [[ -n "$_conda_env" ]]; then
|
[[ -n "$1" ]] && {
|
||||||
if [[ -n "$_ctx" ]]; then
|
[[ -n "$_ctx" ]] && _ctx+=" | $1" || _ctx="$1"
|
||||||
_ctx+=" | ${_conda_env}"
|
}
|
||||||
else
|
}
|
||||||
_ctx="${_conda_env}"
|
|
||||||
fi
|
_ctx_disp "$_git_seg"
|
||||||
fi
|
_ctx_disp "$_conda_env"
|
||||||
if [[ -n "$_venv_env" ]]; then
|
_ctx_disp "$_venv_env"
|
||||||
if [[ -n "$_ctx" ]]; then
|
_ctx_disp "$_session_tags"
|
||||||
_ctx+=" | ${_venv_env}"
|
|
||||||
else
|
|
||||||
_ctx="${_venv_env}"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
if [[ -n "$_session_tags" ]]; then
|
|
||||||
if [[ -n "$_ctx" ]]; then
|
|
||||||
_ctx+=" | ${_session_tags}"
|
|
||||||
else
|
|
||||||
_ctx="${_session_tags}"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
if [[ -n "$_ctx" ]]; then
|
if [[ -n "$_ctx" ]]; then
|
||||||
PS1+="\[${_ctx_fg}${_bar_bg}\] [ ${_ctx} ]"
|
PS1+="\[${_ctx_fg}${_bar_bg}\] [ ${_ctx} ]"
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user