Skip to content
This repository was archived by the owner on Apr 24, 2020. It is now read-only.

add POWERLEVEL9K_VIRTUALENV_SHOW_VERSION option to virtualenv segment#821

Closed
iilonmasc wants to merge 1 commit intoPowerlevel9k:nextfrom
iilonmasc:feature/pyver
Closed

add POWERLEVEL9K_VIRTUALENV_SHOW_VERSION option to virtualenv segment#821
iilonmasc wants to merge 1 commit intoPowerlevel9k:nextfrom
iilonmasc:feature/pyver

Conversation

@iilonmasc
Copy link
Copy Markdown
Member

As discussed in #808
This PR adds a new option to the virtualenv segment.

If you add POWERLEVEL9K_VIRTUALENV_SHOW_VERSION=true to your .zshrc p9k will add your python version to your venv segment

It looks like this:
Using Python2
Imgur
Using Python3
Imgur

Thanks @hiimdoublej for suggesting this!

@dritter
Copy link
Copy Markdown
Member

dritter commented May 8, 2018

Thanks @sambadevi for this PR!

To be honest, I am a bit ambivalent with this PR. On one hand 👍 for creativity (I personally never thought about rendering another segment within one).
If it would be possible to set a condition (which there is, if #771 will be merged), and if there would be a python_version segment that prints out the version, we would get the exact same result (if the colors match and the icon would be set to empty, of course), and it would be combinable with other python env segments..

@iilonmasc
Copy link
Copy Markdown
Member Author

iilonmasc commented May 9, 2018

So @dritter your suggestion is creating a new segment python_version and wait for #771 to add conditionals? I can change this PR to be a separate segment, the code wouldn’t differ that much. But there won’t be any segment combination unless #771 gets merged.


I'd like to stay with this functionality tbh, my intention wasn't to add a new segment just for the python version but to show the python version only if I am in a virtualenv (because I am using both, python2 and 3 in different virtualenvs).
Adding a new segment for pyver would probably help, however adding the virtualenv-only logic in there would need a new variable to control the pyver segment. It's more like a workaround in that case

@dritter
Copy link
Copy Markdown
Member

dritter commented Nov 16, 2018

For the records: The successor of #771 is merged and it is possible to define own conditions for every segment. The condition should look like this P9K_PYTHON_VERSION_CONDITION='[[ -n "${VIRTUAL_ENV}" ]]'. Yes, this is basically a duplication of the condition in the virtualenv segment; that is the trade-off..
That a separate python_version segment makes sense is shown in #1053 .

@bhilburn
Copy link
Copy Markdown
Member

Per @dritter, the project's structure is completely changed in the next branch. It should be pretty easy to port this change over, though!

@iilonmasc
Copy link
Copy Markdown
Member Author

I am closing this PR and will port this change to the new structure in next

@iilonmasc iilonmasc closed this Mar 13, 2019
@iilonmasc iilonmasc deleted the feature/pyver branch March 13, 2019 18:01
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants