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

'pyenv version' replacement for prompt display, using bash-only functions #411

Open
fmeynadier opened this issue Nov 24, 2021 · 0 comments

Comments

@fmeynadier
Copy link

Hi,

Not really an issue, but an idea concerning the long-standing issue of prompt updating (#268, #346, #385, maybe others...)
I guess that one of the incentives for deprecating this feature is its slowlyness, and replaceing it with a call to 'pyenv version' every time is not any better...

On my side I use https://gitlab.com/bersace/powerline.bash and helped including support to pyenv version display in my prompt, purely using bash. I extracted the parts that concern pyenv and assembled a minimal script that you can find here : https://gist.github.com/fmeynadier/23869cdbdaab732396eb46e1ec545dde

It implements the algorithm described in the readme to determine the pyenv virtualenv version, and in my experience it returns the answer ~10 times faster than 'pyenv version': you can feel the difference on the prompt reactivity. Of course it uses bash so porting to other shells may require fine-tuning.

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

1 participant