From: λ? <boojum@stercus-accidit.com>
To: zsh-users@zsh.org
Subject: Issue with precmd used to display venv in prompt
Date: Wed, 2 May 2018 11:35:18 +0100 [thread overview]
Message-ID: <CACfAdfYSOqWLDZs1-S86NxRmgLn+-R=HzOu=f+aTxNiwVktXLA@mail.gmail.com> (raw)
[-- 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.
reply other threads:[~2018-05-02 10:35 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CACfAdfYSOqWLDZs1-S86NxRmgLn+-R=HzOu=f+aTxNiwVktXLA@mail.gmail.com' \
--to=boojum@stercus-accidit.com \
--cc=zsh-users@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).