This repository was archived by the owner on Sep 25, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ function applyAutoenv
3838 set _tree (dirname $_ tree)
3939 end
4040 # If we're *not* in an active venv and the venv source dir exists we activate it and return.
41- if test -z " $VIRTUAL_ENV " -a -e " $_ source"
41+ if test \ ( -z " $VIRTUAL_ENV " -o " $_ autovenv_initialized " = " 0 " \ ) -a -e " $_ source"
4242 source " $_ source"
4343 if test " $autovenv_announce " = " yes"
4444 echo " Activated Virtual Environment ($_ _autovenv_new)"
@@ -66,13 +66,17 @@ function applyAutoenv
6666 end
6767end
6868
69- # We need to run AutoVenv on the initialization of each session .
70- if status is-interactive
69+ # Activates AutoVenv based on directory changes .
70+ function autovenv --on-variable PWD -d " Automatic activation of Python virtual environments "
7171 applyAutoenv
7272end
7373
74- # # AutoVenv Function.
75- # Activates on directory changes.
76- function autovenv --on-variable PWD -d " Automatic activation of Python virtual environments"
77- applyAutoenv
74+ set --global _autovenv_initialized 0
75+
76+ # Activates AutoVenv on initialization of the session after sourcing config.fish.
77+ function __autovenv_on_prompt --on-event fish_prompt
78+ if test " $_ autovenv_initialized" = " 0"
79+ applyAutoenv
80+ set --global _autovenv_initialized 1
81+ end
7882end
You can’t perform that action at this time.
0 commit comments