diff --git a/pure.zsh b/pure.zsh index 508b935..1e5a51f 100644 --- a/pure.zsh +++ b/pure.zsh @@ -233,7 +233,7 @@ prompt_pure_precmd() { if zstyle -T ":prompt:pure:environment:virtualenv" show; then # Check if a Conda environment is active and display its name. if [[ -n $CONDA_DEFAULT_ENV ]]; then - psvar[20]="${CONDA_DEFAULT_ENV//[$'\t\r\n']}" + psvar[20]="${${CONDA_DEFAULT_ENV:t}//[$'\t\r\n']}" fi # When VIRTUAL_ENV_DISABLE_PROMPT is empty, it was unset by the user and # Pure should take back control. diff --git a/tests/virtualenv.zsh b/tests/virtualenv.zsh index c8ca421..e4b7578 100644 --- a/tests/virtualenv.zsh +++ b/tests/virtualenv.zsh @@ -33,6 +33,11 @@ main() { prompt_pure_precmd assert_equal "myenv" "$psvar[20]" "conda env should be shown by default" + # Conda env with full path should show only the basename. + CONDA_DEFAULT_ENV=/path/to/envs/myenv + prompt_pure_precmd + assert_equal "myenv" "$psvar[20]" "conda env should show basename when set to full path" + # Conda env should be hidden when virtualenv style is off. zstyle ':prompt:pure:environment:virtualenv' show no prompt_pure_precmd