Display python symbol version and virtualenv name only if virutalenv is activated #1906
Replies: 3 comments 2 replies
-
According to the documentation, all you need to do is set |
Beta Was this translation helpful? Give feedback.
-
Hi @matthaeusheer, this isn't possible at the moment, only displaying the python module if in a virtualenv, if you open a feature request we can take a look at this. |
Beta Was this translation helpful? Give feedback.
-
For the record, I had the same idea and I've finally found the solution. This is my python section [python]
format = '[(\($virtualenv\)) ](black)' what this does is show ($virtualenv) if $virtualenv exists and is activated, and shows nothing otherwise. The trick is using conditional format strings. The outer () means that $virtualenv will only appear if the variable is not none, which in the case of virtualenv's is when the virtualenv is not activated. The inner () are the paranthesis that are displayed to the screen. Conditional format strings are explained in the configuration section of the website, so you can read up on how it works in more detail. |
Beta Was this translation helpful? Give feedback.
-
The title says it all. How would I achieve that?
So far I use
which makes the python symbol and version pop up when I enter say a directory in which a Pipfile is present. However I want those information only to be displayed, when I actually activated the environment via
pipenv shell
.Cheers,
Matt
Beta Was this translation helpful? Give feedback.
All reactions