In the xonsh shell how can I use the name of the virtual environment I'm use as a condition in the definition of $PROMPT?
(More in detail: I have a virtual environment called 'xonsh' for the xonsh shell itself, but I do not want this venv to be shown in the prompt, but any other activated venv should be shown in the prompt.)
Start by looking at
xonsh/prompt/env.pyto see how we define theenv_namefunction -- since you use virtualenv, you can do something like the following in yourxonshrc:Then add that function to the
$PROMPT_FIELDSdictionary:$PROMPT_FIELDS['env_name_cust'] = env_name_custThen you can use
{env_name_cust}in your$PROMPTformatting string in place of the default{env_name}You can also use
${...}as a substitute for__xonsh__.envif you like.