MichaelAquilina/zsh-autoswitch-virtualenv

Does not work in nvim terminal

navxio opened this issue · 1 comments

navxio commented

Issue Details

Please provide the following details when opening an issue:

Operating System (uname -a)

Darwin (macos)

zsh version (zsh --version)

5.9

autoswitch-virtualenv version

3.6.0

How is zsh-autoswitch-virtualenv installed?

zinit light MichaelAquilina/zsh-autoswitch-virtualenv

Steps to reproduce the issue

  • navigate to poetry project
  • launch nvim instance inside using nvim .
  • launch embedded terminal using :term
  • echo $PATH which is bereft of virtualenv path

neovim version 0.9.1

gist link to your zshrc

https://gist.github.com/navxio/522ad8f50f16fcf6fe29d645ae79c3fc

navxio commented

I found a temporary workaround by creating virtualenvs in the project directory itself using poetry config virtualenvs.in-project and this to my zshrc

precmd() {
  # Activate the virtualenv for the current directory
  if [[ -f "$PWD/.venv/bin/activate" ]]; then
    source "$PWD/.venv/bin/activate"
  fi
}

It appears the virtualenv is not auto activated when spawning the terminal for the first time even if the current dir contains a poetry.lock file..