From 04e877710cc3d3d569cf79a08dfeb0952dab177d Mon Sep 17 00:00:00 2001 From: Zorion Arrizabalaga Date: Mon, 27 Oct 2025 11:17:26 +0100 Subject: [PATCH] Autoload compdef for zsh. --- uv-virtualenvwrapper.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/uv-virtualenvwrapper.sh b/uv-virtualenvwrapper.sh index 4cfdd8b..a07237c 100644 --- a/uv-virtualenvwrapper.sh +++ b/uv-virtualenvwrapper.sh @@ -91,6 +91,13 @@ lsvirtualenv() { find "$WORKON_HOME" -mindepth 1 -maxdepth 1 -type d -exec basename {} \; 2>/dev/null } +__autoload_compdef() { + if ! typeset -f compdef >/dev/null; then + autoload -Uz compinit + compinit + fi +} + # Setup tab completion __uvvirtualenvwrapper_setup() { if [ -n "${BASH:-}" ]; then @@ -106,6 +113,7 @@ __uvvirtualenvwrapper_setup() { venvs=($(lsvirtualenv)) _describe 'virtualenvs' venvs } + __autoload_compdef compdef _virtualenvs workon rmvirtualenv fi }