From e50989e39a07b23ee34e1fefc13a8fa406159a22 Mon Sep 17 00:00:00 2001 From: Arti Zirk Date: Tue, 29 Oct 2024 16:21:14 +0200 Subject: [PATCH] Always read custom venv prompt from config file And ignore VIRTUAL_ENV_PROMPT variable for now as it is different between venv and virtualenv implementations: * https://github.com/python/cpython/pull/106726 * https://github.com/pypa/virtualenv/pull/2606 --- .zshrc | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.zshrc b/.zshrc index 3df3665..0b5af74 100644 --- a/.zshrc +++ b/.zshrc @@ -5,11 +5,8 @@ zmodload zsh/pcre # Virtualenv support function _virtual_env_prompt () { - # new pyvenv has a seperate variable for custom prompt value - REPLY=${VIRTUAL_ENV_PROMPT+${VIRTUAL_ENV_PROMPT}} - # Try to read the prompt name form pyvenv.cfg - if [[ -z "${REPLY}" && -f "$VIRTUAL_ENV/pyvenv.cfg" ]]; then + if [[ -f "$VIRTUAL_ENV/pyvenv.cfg" ]]; then # Matches lines with following syntax # prompt = 'cool prompt' # prompt = "cool prompt" @@ -32,7 +29,7 @@ function _virtual_env_prompt () { fi fi - # support old-school virtualenv + # fall back to using venv folder name as prompt name if [[ -z "${REPLY}" ]]; then REPLY=${VIRTUAL_ENV+(${VIRTUAL_ENV:t}) } fi