zsh-git-venv-prompt is a Zsh plugin that enhances your Zsh prompt with information about the current Python virtual environment and the Git status (asynchronously). It uses zsh-async to provide async updates for Git status and displays the virtual environment in the second line of the prompt.
- Displays the name of the active Python virtual environment (if any).
- Shows the current Git branch and changes (staged, unstaged, clean) asynchronously.
- Supports a two-line prompt:
- First line: Username, hostname, and current directory.
- Second line: Python virtual environment (if active), followed by Git status.
- zsh-async: This plugin requires
zsh-asyncfor asynchronous Git status updates. - zsh-vi-mode (optional): For vi-mode integration and mode indicators.
You can install the dependencies using a plugin manager like znap:
znap source mafredri/zsh-async
znap source jeffreytse/zsh-vi-mode # Optional for vi-mode supportTo install this plugin using znap, add the following line to your .zshrc:
znap source walkingshamrock/zsh-git-venv-prompt- Clone the repository to your ~/.zsh/plugins/ directory:
git clone https://github.com/walkingshamrock/zsh-git-venv-prompt.git ~/.zsh/plugins/zsh-git-venv-prompt- Add the following line to your .zshrc:
source ~/.zsh/plugins/zsh-git-venv-prompt/zsh-git-venv-prompt.plugin.zsh- Reload your .zshrc:
source ~/.zshrcThe plugin automatically configures a two-line prompt:
- First line: Displays your username, hostname, and current directory.
- Second line: Displays the Python virtual environment (if active), followed by Git branch and status.
You can customize the prompt symbols by setting these variables in your .zshrc before loading the plugin:
# Customize prompt symbols (optional)
export ZGVP_DEFAULT_SYMBOL="$" # Default symbol (default: ">")
export ZGVP_INSERT_SYMBOL="#" # Symbol for insert mode (default: ">", or ZGVP_DEFAULT_SYMBOL if set)
export ZGVP_NORMAL_SYMBOL="N" # Symbol for normal mode (default: "<")
export ZGVP_VISUAL_SYMBOL="V" # Symbol for visual mode (default: "<")
export ZGVP_REPLACE_SYMBOL="R" # Symbol for replace mode (default: "<")
# Load the plugin
znap source walkingshamrock/zsh-git-venv-promptDefault behavior without any customization:
- Insert mode and non-vi-mode:
> - Normal/Visual/Replace modes:
<
If you only set ZGVP_DEFAULT_SYMBOL:
- Insert mode and non-vi-mode will use your default symbol
- Other modes still use
<unless explicitly overridden
Once installed, the plugin will automatically display:
- The name of the currently active Python virtual environment (if any).
- The current Git branch and status asynchronously:
+for staged changes*for unstaged changes✔for clean status (when no changes)
For example, your prompt will look like this:
user@hostname /path/to/dir (main) + *
(venv) >
Contributions are welcome! If you find a bug or have an improvement, please open an issue or submit a pull request.
Special thanks to pure for their inspiration and influence in designing the shell prompts.
This plugin is licensed under the MIT License. See the LICENSE file for details.
