1
0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2026-04-12 17:29:32 +00:00

5 Commits

Author SHA1 Message Date
AYO-YO
b4c23eff3c Merge f4b09de2e7 into 9e2c1548c3 2026-03-30 23:30:28 +08:00
赵春旭
f4b09de2e7 feat(theme): Optimize the display effect of conda in the agnoster theme; standardize the code 2025-06-13 09:40:51 +08:00
AYO_YO
4974ffa6a0 Merge branch 'ohmyzsh:master' into master 2025-06-13 09:39:59 +08:00
Carlo Sala
65c3e10e38 revert to original order 2025-06-08 10:22:26 +02:00
赵春旭
0207f6f8f4 feat(theme): Make agnoster support conda environment 2025-06-08 11:29:40 +08:00

View File

@@ -80,6 +80,8 @@ esac
# VirtualEnv colors
: ${AGNOSTER_VENV_FG:=black}
: ${AGNOSTER_VENV_BG:=blue}
: ${AGNOSTER_CONDA_FG:=${CURRENT_FG}}
: ${AGNOSTER_CONDA_BG:=magenta}
# AWS Profile colors
: ${AGNOSTER_AWS_PROD_FG:=yellow}
@@ -314,9 +316,15 @@ prompt_dir() {
# Virtualenv: current working virtualenv
prompt_virtualenv() {
if [ -n "$CONDA_DEFAULT_ENV" ]; then
prompt_segment magenta $CURRENT_FG "🐍 $CONDA_DEFAULT_ENV"
if [[ -n $CONDA_DEFAULT_ENV && -z $CONDA_ENV_DISABLE_PROMPT ]]; then
# You can execute this command to disable conda native prompt.
# `conda config --set changeps1 False`
local conda_prompt_prefix=${CONDA_PROMPT_PREFIX:-"🐍 "}
# local conda_prompt_prefix="$CONDA_PROMPT_PREFIX"
prompt_segment "$AGNOSTER_CONDA_BG" "$AGNOSTER_CONDA_FG" "$conda_prompt_prefix$CONDA_DEFAULT_ENV"
fi
if [[ -n "$VIRTUAL_ENV" && -n "$VIRTUAL_ENV_DISABLE_PROMPT" ]]; then
prompt_segment "$AGNOSTER_VENV_BG" "$AGNOSTER_VENV_FG" "(${VIRTUAL_ENV:t:gs/%/%%})"
fi