Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Why are prompt expansions of %v sequences quoted in bindkey style?



Thanks, I think that might work for me. 

I am indeed trying to use $psvar to dynamically update my prompt’s visual formatting, without the use of prompsubst or changing $PS1.

> On 23. Jan 2024, at 22.21, Mikael Magnusson <mikachu@xxxxxxxxx> wrote:
> 
> On 1/23/24, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
>>> On Tue, Jan 23, 2024 at 10:44 AM Marlon Richert
>>> <marlon.richert@xxxxxxxxx> wrote:
>>> 
>>> However, the quoting seems to make it impossible to use $psvar for
>>> anything involving control characters.
>> 
>> That's correct.  Anything involving control characters would also
>> require %{...%} or %G to specify the occupied screen width.
>> 
>>> Is there no way to work around this?
>> 
>> As Roman mentioned, the usual way is to use precmd to update prompt values.
> 
> fwiw, you can do things like %F{%5v}hello or %(3V.%B.) to make things
> dynamic without using promptsubst or updating PS1 in precmd, but you
> do have to have all the actual formatting in PS1 then.
> 
> --
> Mikael Magnusson




Messages sorted by: Reverse Date, Date, Thread, Author