zsh-users
 help / color / mirror / code / Atom feed
From: "Lawrence Velázquez" <vq@larryv.me>
To: Sebastian Stark <sstark+zsh@mailbox.org>
Cc: zsh-users@zsh.org
Subject: Re: Dynamic parameters for PROMPT_SUBST functions
Date: Fri, 19 Jun 2020 02:58:18 -0400	[thread overview]
Message-ID: <E0295958-2E53-46D0-9840-23988F2658C4@larryv.me> (raw)
In-Reply-To: <20200619063233.zybs27xvqp56t4p5@singold>

Hi Sebastian,

> On Jun 19, 2020, at 2:32 AM, Sebastian Stark <sstark+zsh@mailbox.org>
> wrote:
> 
> I am trying to have a function call in my prompt that gets the
> return value of the last command as a parameter (%?).
> 
> However I am having trouble to get this right. Instead of an actual
> number, what is handed to the function is the literal string %?.

Yes, that is because the PROMPT_SUBST expansions (parameter, command,
and arithmetic) are done before the percent-escape sequences are
expanded.

vq

  reply	other threads:[~2020-06-19  6:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-19  6:32 Sebastian Stark
2020-06-19  6:58 ` Lawrence Velázquez [this message]
2020-06-19 10:56 ` Daniel Shahaf
2020-06-19 17:08   ` Sebastian Stark
2020-06-20 11:06     ` Daniel Shahaf
2020-06-21 15:17       ` Sebastian Stark

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=E0295958-2E53-46D0-9840-23988F2658C4@larryv.me \
    --to=vq@larryv.me \
    --cc=sstark+zsh@mailbox.org \
    --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).