Closed yujinyuz closed 2 years ago
Have you tried guarding the call to source asdf in config.fish?
In my case fish is my login shell so guarding it like this would mean it is only sourced once:
if status is-login
source ~/.asdf/asdf.fish
end
@ammgws I did try adding if status is-login
but it is still getting sourced when opening a new split using bind-key - split-window -v -c '#{pane_current_path}'
I think it's because the auto activation feature is relying on a PWD
change variable
function __vfsupport_auto_activate --on-variable PWD
and since PWD is not being changed when opening a tmux split pane with the current path, it doesn't trigger the auto activation
My current workaround is
# config.fish
# Load asdf-vm
if status is-login
source ~/.asdf/asdf.fish
emit asdf_loaded
end
Then I modified my auto_activation.fish
function __vfsupport_auto_activate --on-event asdf_loaded --on-variable PWD
....
some code here
....
if test $new_virtualenv_name != ""
# if the virtualenv in the file is different, switch to it
# if begin; not set -q VIRTUAL_ENV; or test $new_virtualenv_name != (basename $VIRTUAL_ENV); end
if begin; or test $new_virtualenv_name != (basename $VIRTUAL_ENV); end
vf activate $new_virtualenv_name
set -g VF_AUTO_ACTIVATED $activation_root
end
For some reason, things started working again. I'm not sure how and why..
Issue
So, I'm currently using
asdf-vm
with fish shell and tmux.When I'm inside tmux, I typically press
<Prefix> -
to open a split pane belowProblem:
When I'm inside a directory where auto activation is enabled via
vf connect myvenv
,type python
produces~/.virtualenvs/myvenv/python
$PATH looks like
But if I open a new split pane via
<Prefix>-
,type python
produces~/.asdf/shims/python
$PATH looks likeOne reason probably is that
~/.config/fish/config.fish
is sourced everytime I press<Prefix>-
, thus running thesource ~/.asdf/asdf.fish
and re-modifying the path.I'm not quite sure what to do at this point so if anyone could point me in the right direction, I would really appreciate it!
The $VIRTUAL_ENV variable is being set properly. The problem is with the $PATH since it gets jumbled thus not using the virtualenvs' path appropriately