Open v1gnesh opened 1 year ago
Anything I can do to make this work?
Update: I went looking into segment-virtualenv, and found that it (first) looks for the 'prompt' keyword in pyenv.cfg. So I deleted existing virtualenvs and venvs, then created one each of virtualenv and venv with --prompt seg-name, and it works alright now.
It would be amazing if the direnv segment automatically shows info about the activated env (be it python or whatever else), by wrapping over powerline-go's venv, etc.
Still think this would be neat.
Seeing just the directory name again is not adding much value (direnv segment).
Alternatively, instead of segment-direnv wrapping segment-virtualenv etc., I could directly just use the available *env modules/segments. BUT, to avoid repetition in the prompt (direnv segment showing $PWD) in addition to the right side of the prompt already showing $PWD, I think a good solution is to have the segment-direnv not create a new segment, but just colourize the $PWD segment, indicating the activation of a direnv.
RIght now, $PWD comes with bold text. By doing the above, imagine if it were bold and coloured (to indicate direnv). This will save space on the prompt.
What do you think? 😄
Not 100% sure of direnv, but I think the bug https://github.com/justjanne/powerline-go/pull/387 being fixed here is at least adjacent to what your'e seeing. The issue with the --prompt
flag and the prompt
key in pyvenv.cfg
is that the behavior of virtualenv changed with >= python 3.6, where the key was no longer written by default and the flat is supplemental.
I would be interested in seeing if you have the time or interest to test that fork and see if the same behavior exists or not.
Edit: *fork, not actually forking, but the fork the PR is being made from :t-rex:
@elebertus, will give it a go and report back.
EDIT: It works, thank you!
Say I have this directory structure:
py-pandas/ py-pandas/.envrc py-pandas/.direnv py-pandas/.direnv/venv-de
venv-de is a directory created by running
python -m venv venv-de
from inside py-pandas.I'm using direnv, and have both direnv and venv modules in the powerline-go prompt. When I cd into py-pandas, I see the direnv segment, and it activates the venv ok (confirmed by running
python -c "import sys;print(sys.prefix
). It prints<blabla>/py-pandas/.direnv/venv-de
.Then, from py-pandas directory, when I do
mv .direnv/venv-de .direnv/venv-do
, the venv segment magically shows up. Of course, by now the venv is "broken" and I'm not "in" it.direnv and venv segments work ok in a faster machine (arch s390x)I have access to. I should note that the above problem is on a zOS system (same architecture, different OS) that is quite slow (small).
So I wonder if there's a timing issue.
Both direnv and powerline-go updates the $PROMPT_COMMAND, and am using bash. powerline-go sets it to
PROMPT_COMMAND="_update_ps1; $PROMPT_COMMAND"
, but then direnv also updates this. When I issueecho $PROMPT_COMMAND
(while the venv segment shows the venv's name, but I've renamed the venv directory underneath it), this is what it says -_update_ps1; _direnv_hook
.Anything I can do to make this work? It would be amazing if the direnv segment automatically shows info about the activated env (be it python or whatever else), by wrapping over powerline-go's venv, etc. Seeing just the directory name again is not adding much value (direnv segment).
Shell: bash OS: zOS
Thanks for this excellent, excellent tool. I'm really enjoying it ❤️