MichaelAquilina / zsh-autoswitch-virtualenv

🐍 ZSH plugin to automatically switch python virtualenvs (including pipenv and poetry) as you move between directories
GNU General Public License v3.0
507 stars 80 forks source link

Does not work in nvim terminal #192

Open navxio opened 1 year ago

navxio commented 1 year ago

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

neovim version 0.9.1

gist link to your zshrc

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

navxio commented 10 months ago

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..