Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Processing "%?" in PROMPT?
- X-seq: zsh-users 24453
- From: Roman Perepelitsa <roman.perepelitsa@xxxxxxxxx>
- To: Christopher Nebel <c.nebel@xxxxxxxxx>
- Subject: Re: Processing "%?" in PROMPT?
- Date: Wed, 20 Nov 2019 22:42:00 +0100
- Cc: zsh-users <zsh-users@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=acwNFnU1QStR/ay7HPp+eukIFaWRr9YfE2W3uAQQJco=; b=teo88FqcGLmvnOZ2qDEtVc0PmT4+hJEkBieivq9TJZoqNGR4ZMkfUe4/SVjpGuauKx Qwm2jcIWle36rr9EYSRbmxgrErvt8G8OSWPjAgTScv27SX7nYf+MzZ8fMu1vD0ICOsza REahnyGkV17r1XuEWvhdnvaG+okJAs3P8vrAZgseHLmh1tQLLCkDxsGw5dhM8T3SJpty 5mWeMQ8mbqjdVWH8p+8NsfmcgHXsF/1CDyGkO/f0GArV81BF9F9i8LmDiL4f84ym+LXB J+0hrUhF+3TSSP7TxQmIRrTk3L8WZF/WnP88SLvekYi1BVNdmZLmiyxbX1tzBwimhACG 8heA==
- In-reply-to: <2879A761-D4D3-44C5-8D54-D58D9E3F5EBF@apple.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- List-unsubscribe: <mailto:zsh-users-unsubscribe@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <2879A761-D4D3-44C5-8D54-D58D9E3F5EBF@apple.com>
On Wed, Nov 20, 2019 at 10:28 PM Christopher Nebel <c.nebel@xxxxxxxxx> wrote:
> My first attempt was to set PROMPT to ‘$(pretty-status %?)’
$? will work the way you want if it's the first command substitution
in PROMPT. The same goes for RPROMPT.
> I could use a precmd function to save $? in a global, but only if
> I could guarantee that it was called before anything else, and that’s
> not a promise I’m comfortable making.
$? (a.k.a. $status) and $pipestatus are guaranteed to work as you
expect when precmd hooks are called. It's quite common to stash them
into global variables there.
Roman.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author