Skip to content

conda environments use the wrong environmental variable #154

@mwyschan

Description

@mwyschan

Describe the bug
See title, the same bug is mentioned here: romkatv/powerlevel10k#762
When a conda environment is activated (in my case, through Miniforge), typewritten uses $CONDA_PREFIX

elif [[ ! -z $CONDA_PREFIX ]]; then
tw_virtual_env="$CONDA_PREFIX"

On the base environment, this is what I get:

CONDA_PREFIX=/home/username/.miniforge3
CONDA_DEFAULT_ENV=base
CONDA_PROMPT_MODIFIER=(base)

On environment test, this is what I get:

CONDA_PREFIX=/home/username/.miniforge3/envs/test
CONDA_DEFAULT_ENV=test
CONDA_PROMPT_MODIFIER=(test)
CONDA_PREFIX_1=/home/username/.miniforge3

On the base environment, the prefix becomes (.miniforge) instead of (base), whereas on environment test, the prefix is correctly shown as (test).

typewritten should use either CONDA_DEFAULT_ENV or CONDA_PROMPT_MODIFIER instead of CONDA_PREFIX to indicate the current conda environment.

To Reproduce
Steps to reproduce the behavior:

  1. Install Miniforge with conda init
  2. Restart shell
  3. See that the prefix is wrong

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions