You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add the plugin to the list of plugins for Oh My Zsh to load (inside ~/.zshrc):
plugins=(
...
zsh-uv-env
)
Start a new terminal session.
How It Works
The plugin automatically detects and activates Python virtual environments (.venv
directories) as you navigate through your filesystem. When you leave a directory with an
active virtual environment, it automatically deactivates it.
Post-Hooks
This plugin supports post-hooks that allow you to execute custom commands after a
virtual environment is activated or deactivated.
Adding Post-Hooks
You can add post-hooks in your .zshrc file:
# Define hook functions_venv_post_hook() {
v cd
v venv
}
_venv_post_hook_deactivate() {
v cd
v reset_venv
}
# Register the hooks
zsh_uv_add_post_hook_on_activate '_venv_post_hook'
zsh_uv_add_post_hook_on_deactivate '_venv_post_hook_deactivate'
Then call this function in your .zshrc.
Available Hook Functions
zsh_uv_add_post_hook_on_activate: Register a function to run after a virtual environment is activated
zsh_uv_add_post_hook_on_deactivate: Register a function to run after a virtual environment is deactivated
About
zsh-uv-env is a plugin for zsh and uv. It automatically activates a virtual environment based on the current directory