Jelajahi Sumber

feat(zsh): activate Python virtual envs for subshells

Joe 9 bulan lalu
induk
melakukan
a9f9e0232d
1 mengubah file dengan 10 tambahan dan 0 penghapusan
  1. 10 0
      .config/zsh/.zshenv

+ 10 - 0
.config/zsh/.zshenv

@@ -159,6 +159,16 @@ if [[ ! "$(launchctl getenv $lctl_env_label)" == "TRUE" ]]; then
     launchctl setenv $lctl_env_label TRUE
 fi
 
+################################################################################
+# Activate Python virtual environments
+################################################################################
+
+if [[ -n $VIRTUAL_ENV && \
+      $VIRTUAL_ENV = "$HOME"* && \
+      -e "${VIRTUAL_ENV}/bin/activate" ]]; then
+  source "${VIRTUAL_ENV}/bin/activate"
+fi
+
 ################################################################################
 # Private or system-specific environment variables
 ################################################################################