Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Issue with precmd used to display venv in prompt



ahoy,

i've a issue with displaying current python virtualenv in prompt. it
*almost* works - precmd dose display it but it requires an extra "enter"
keypress before doing so. here's the code:


emulate -RL zsh
setopt prompt_subst

function pyenv-prompt() {
    if [[ -v VIRTUAL_ENV ]]; then
        VENV_P="%4F(${VIRTUAL_ENV##*/})%f"
    else
        VENV_P=""
    fi
}

prompt_x_setup() {

    function precmd() {
        pyenv-prompt
    }

    PS1='$VENV_P > '
}

prompt_x_setup "$@"


any pointers on how i can avoid that extra "enter" will be appreciated!


-- 
b.


Messages sorted by: Reverse Date, Date, Thread, Author