Skip to content

Instantly share code, notes, and snippets.

@Maple-pro
Created July 12, 2023 18:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Maple-pro/c3528b59bf2aaccaf1bcc459e6bd548a to your computer and use it in GitHub Desktop.
Save Maple-pro/c3528b59bf2aaccaf1bcc459e6bd548a to your computer and use it in GitHub Desktop.
My `~/.oh-my-zsh/custom/themes/lambda.zsh-theme` file, which is a custom oh-my-zsh theme based on lambda.
function precmd_get_conda_env_name() {
if [[ -n $CONDA_PREFIX ]]; then
if [[ $(basename $CONDA_PREFIX) == "mambaforge" ]]; then
CONDA_ENV="base"
else
CONDA_ENV="$(basename $CONDA_PREFIX)"
fi
else
CONDA_ENV=""
fi
echo $CONDA_ENV
}
PROMPT='%{$fg[blue]%}%n@%m%{$reset_color%} %(?:%{$fg_bold[green]%}➜:%{$fg_bold[red]%}➜)%{$reset_color%} ($(precmd_get_conda_env_name)) λ %~/ $(git_prompt_info)%{$reset_color%}'
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "
@Maple-pro
Copy link
Author

Usage:

  1. Install zsh and oh-my-zsh
  2. Set zsh theme to lambda in ~/.zshrc
  3. Put the custom lambda theme file into ~/.oh-my-zsh/custom/themes/
  4. Disable the default conda prompt modifier: conda config --set changeps1 false

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment