Skip to content

Instantly share code, notes, and snippets.

@yeiichi
Created March 26, 2026 12:07
Show Gist options
  • Select an option

  • Save yeiichi/f7c4e3fce8b9c69d9698cff7cd9d1d0d to your computer and use it in GitHub Desktop.

Select an option

Save yeiichi/f7c4e3fce8b9c69d9698cff7cd9d1d0d to your computer and use it in GitHub Desktop.
Configures a dynamic Zsh prompt that displays the current Python virtual environment name without breaking standard formatting
# Set up the prompt
# 1. This MUST be here for the $(...) or ${...} to work
setopt PROMPT_SUBST
# 2. Tell the venv script not to mess with the prompt
export VIRTUAL_ENV_DISABLE_PROMPT=1
# 3. The prompt string (no spaces inside the parentheses)
PROMPT='${VIRTUAL_ENV:+(${VIRTUAL_ENV:t}) }%m:%1~ %# '
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment