Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Help fix Zsh shell command prompt error or stranee
On Tue, Aug 22, 2023 at 1:37 AM Grant Taylor <gtaylor@xxxxxxxxxxxxxxxxxx> wrote:
>
> On 8/20/23 1:30 AM, Roman Perepelitsa wrote:
> > In the vast majority of cases one can replace %{...%} with a
> > first-class %-sequence.
>
> I question the "vast" quantifier.
I'm intrigued. When is %{...%} necessary?
These are the use-cases I know of, and I would venture a guess that
they apply to a small minority of users:
1. To work around bugs in the terminal. For example, if the terminal
displays "X" as a wide character, you would need to use "%2{X%}"
instead of the plain "X".
2. To embed special markers at the start and the end of the prompt
that are recognized by the terminal.
3. To use styling that isn't available through %-escapes. For example,
italic, or dim.
Are there any other use cases for %{...%}?
Note that it's not necessary (and not a good idea anyway) to embed
special terminal commands into prompt. Things like setting the
terminal title, notifying the terminal about the current working
directory, etc. These are better done by writing to the TTY in the
corresponding hooks (precmd, chpwd, etc.). This is different from
prompt markers that I mentioned above, which must be embedded into the
prompt.
Roman.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author