xonsh.prompt.env¶
Prompt formatter for virtualenv and others
- xonsh.prompt.env.emit_osc7(**kwargs) None[source]¶
Emit an OSC 7 escape sequence to report the current working directory.
Terminals use this for features like “Open new tab in same directory” and macOS Terminal.app session restoration.
- xonsh.prompt.env.env_name() str[source]¶
Build env_name based on different sources. Respect order of precedence.
Name from
$VIRTUAL_ENV_PROMPTis used as-is — so users can override the prompt verbatim. As an exception, if the value matches the name derived from$VIRTUAL_ENV(via theprompt=field inpyvenv.cfgor the directory basename), it is treated as a value auto-populated byactivate.xshand wrapped with{env_prefix}/{env_postfix}like the other sources. Names from other sources are always surrounded with{env_prefix}and{env_postfix}.
- xonsh.prompt.env.find_env_name() str | None[source]¶
Find current environment name from available sources.
If
$VIRTUAL_ENVis set, it is determined from the prompt setting in<venv>/pyvenv.cfgor from the folder name of the environment.Otherwise - if it is set - from
$CONDA_DEFAULT_ENV.
- xonsh.prompt.env.vte_new_tab_cwd() None[source]¶
This prints an escape sequence that tells VTE terminals the hostname and pwd. This should not be needed in most cases, but sometimes is for certain Linux terminals that do not read the PWD from the environment on startup. Note that this does not return a string, it simply prints and flushes the escape sequence to stdout directly.