Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deactivates the oh-my-zsh theme when activating the venv #153

Open
bolinocroustibat opened this issue May 8, 2021 · 4 comments
Open

Deactivates the oh-my-zsh theme when activating the venv #153

bolinocroustibat opened this issue May 8, 2021 · 4 comments

Comments

@bolinocroustibat
Copy link

bolinocroustibat commented May 8, 2021

Issue Details

Sometimes deactivate my oh-my-zsh prompt theme when autoactivating the virtual env.
Seems to happens randomly for now, didn't find the exact steps to reproduce the issue yet, but happens quite often. Will update this ticket if I find any clue.

I'm using Pyenv Python version depending on the dir, and Poetry created virtual envs.

Operating System (uname -a)

MacOS 11.3 - Darwin Kernel Version 20.4.0

zsh version (zsh --version)

zsh 5.8

autoswitch-virtualenv version

3.1.1

How is zsh-autoswitch-virtualenv installed?

  • oh-my-zsh

gist link to your zshrc

https://gist.github.com/bolinocroustibat/4f7770c27b258ed97520be54fa7ca65b

@bolinocroustibat bolinocroustibat changed the title Sometimes deactivate the oh-my-zsh theme when auto activate the virtual env Deactivates the oh-my-zsh theme when activating the virtual env May 8, 2021
@bolinocroustibat bolinocroustibat changed the title Deactivates the oh-my-zsh theme when activating the virtual env Deactivates the oh-my-zsh theme when activating the venv May 8, 2021
@MichaelAquilina
Copy link
Owner

@bolinocroustibat was this plugin manually installed into oh-my-zsh?

I cant reproduce this issue based on what you've provided. So I think our best bet would be for you to find/create a git repo which reproduces this issue so that I can test and fix it myself

@bolinocroustibat
Copy link
Author

bolinocroustibat commented May 12, 2021

@MichaelAquilina
It was installed with git clone into the custom plugins folder, then the plugin added to .zshrc.
I'm not sure how to create a git repo with shell to reproduce. Will update the ticket if more clues

@camillol
Copy link

I have run into this problem too. I narrowed it down as follows:

  • It is the virtualenv bin/activate script that breaks the prompt. If you comment out the _validated_source "$activate_script" line in the autoswitch plugin, it leaves the prompt alone. And if you source bin/activate manually in the shell, it also breaks the prompt. So this is not really a bug with the plugin.
  • The breakage only happens if you had previously activated a virtualenv in .zprofile. If you activated it in .zshrc instead, it doesn't happen.

So, by removing the activation of a defualt virtualenv in .zprofile, the problem went away for me. This was also on a Mac. Hope this helps.

@philnelson
Copy link

I have had the same issue for a long time (macOS as well) but finally the fix here by @camillol works for me. No ill-effects so far.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants