From 27bbc9a4b4ffb7bb3cb92bcfb4819acf33ecda98 Mon Sep 17 00:00:00 2001 From: Jeonguk Choi Date: Tue, 25 Jan 2022 14:40:38 +0900 Subject: [PATCH] add plugin for conda --- plugins/conda/README.md | 18 ++++++++++++++++++ plugins/conda/conda.plugin.zsh | 7 +++++++ 2 files changed, 25 insertions(+) create mode 100644 plugins/conda/README.md create mode 100644 plugins/conda/conda.plugin.zsh diff --git a/plugins/conda/README.md b/plugins/conda/README.md new file mode 100644 index 000000000..1131fe855 --- /dev/null +++ b/plugins/conda/README.md @@ -0,0 +1,18 @@ +# conda + +The plugin displays information of the created virtual container of conda and allows background theming. + +To use it, add `conda` to the plugins array of your zshrc file: +``` +plugins=(... conda) +``` + +The plugin creates a `conda_prompt_info` function that you can use in your +theme, which displays the basename of the current `$CONDA_DEFAULT_ENV`. It uses +two variables to control how that is shown: + +- `ZSH_THEME_CONDA_PREFIX`: sets the prefix of the CONDA_DEFAULT_ENV. +Defaults to `[`. + +- `ZSH_THEME_CONDA_SUFFIX`: sets the suffix of the CONDA_DEFAULT_ENV. +Defaults to `]`. diff --git a/plugins/conda/conda.plugin.zsh b/plugins/conda/conda.plugin.zsh new file mode 100644 index 000000000..4b272893a --- /dev/null +++ b/plugins/conda/conda.plugin.zsh @@ -0,0 +1,7 @@ +function conda_prompt_info(){ + [[ -n ${CONDA_DEFAULT_ENV} ]] || return + echo "${ZSH_THEME_CONDA_PREFIX=[}${CONDA_DEFAULT_ENV:t:gs/%/%%}${ZSH_THEME_CONDA_SUFFIX=]}" +} + +# disables display (${CONDA_DEFAULT_ENV}) +export CONDA_CHANGEPS1=false