ohmyzsh/plugins/virtualenv
2025-03-12 19:22:59 +00:00
..
README.md docs(virtualenv): Document how the virtual env prompt is computed 2025-03-12 19:22:59 +00:00
virtualenv.plugin.zsh feat(virtualenv): Use $VIRTUAL_ENV_PROMPT if set 2025-03-11 22:12:20 +00:00

virtualenv

The plugin displays information of the created virtual container and allows background theming.

To use it, add virtualenv to the plugins array of your zshrc file:

plugins=(... virtualenv)

The plugin creates a virtualenv_prompt_info function that you can use in your theme. It displays the prompt string set in the $VIRTUAL_ENV_PROMPT environment variable. The activate scripts for most Python virtual environment implementations set this variable to the value provided via the --prompt option when creating the virtual environment, or the basename of the environment directory if the option was not provided. For implementations that do not set $VIRTUAL_ENV_PROMPT, the plugin will display the basename of the virtual environment directory instead.

It uses two variables to control how that is shown:

  • ZSH_THEME_VIRTUALENV_PREFIX: sets the prefix of the VIRTUAL_ENV. Defaults to [.

  • ZSH_THEME_VIRTUALENV_SUFFIX: sets the suffix of the VIRTUAL_ENV. Defaults to ].