zsh-users
 help / color / mirror / code / Atom feed
* Issue with precmd used to display venv in prompt
@ 2018-05-02 10:35 λ?
  0 siblings, 0 replies; only message in thread
From: λ? @ 2018-05-02 10:35 UTC (permalink / raw)
  To: zsh-users

[-- Attachment #1: Type: text/plain, Size: 570 bytes --]

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.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-05-02 10:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-02 10:35 Issue with precmd used to display venv in prompt λ?

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).