Skip to content

Conversation

@romirk
Copy link
Contributor

@romirk romirk commented Feb 9, 2024

Hi! I use pyenv every day, and it is truly a lifesaver. The only thing that bugs me is the fact that activating a virtual environment does not change the prompt in fish. I have introduced this fix which caches the old prompt and displays a new one with the appropriate prefix.

> pyenv virtualenv 3.12 test 
> pyenv activate test
(test) > pyenv virtualenv 3.12 test1
(test) > pyenv activate test1
(test1) > pyenv deactivate
> 

Note: old prompt is cached in _pyenv_old_prompt. It is automatically erased during deactivation and accounted for during activation.

I hope this is useful to everyone else! Thanks for your consideration.

@romirk romirk changed the title Fix fish promptR Fix fish prompt Feb 9, 2024
@native-api
Copy link
Member

I hope this is useful to everyone else!

It certainly is!

Please also adjust the tests to correspond to the changed code though 🙂

@romirk
Copy link
Contributor Author

romirk commented Feb 12, 2024

Please also adjust the tests to correspond to the changed code though 🙂

I've added them now and tests pass locally.

@native-api native-api merged commit 0f83c33 into pyenv:master Feb 12, 2024
@native-api native-api changed the title Fix fish prompt Add fish prompt changing Feb 12, 2024
@romirk romirk deleted the fish-prompt branch February 12, 2024 10:10
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

Successfully merging this pull request may close these issues.

2 participants