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

Re: Why does zsh clear to end-of-screen after prompt?



On Sat, Aug 26, 2023 at 3:00 AM John Hawkinson <jhawk@xxxxxxxxxxxx> wrote:
>
> In case it wasn't apparent, the use case is I had a small ad hoc
> script that produced ~20 lines of key/value output and sometimes
> the values change and I'd like to keep them in the same position on
> the screen and just overwrite themselves when they change if I
> rerun the script with up-arrow/RET.

An alternative solution is to embed the info in PROMPT. In order to
avoid wasting 20 lines of the TTY real estate on each command, you can
automatically contract the prompt before executing each command. Thus,
if you run `pwd` twice in a row, your TTY might look like this:

    me@box ~ % pwd
    /home/me
    me@box ~ % pwd
    /home/me

    foo=bar
    baz=qux
    me@box ~ % █

In this approach the extra info ("foo=bar", etc.) is always displayed
right above the current prompt. This is basically Transient Prompt
from Powerlevel10k
(https://raw.githubusercontent.com/romkatv/powerlevel10k-media/master/transient-prompt.gif)
but with a fatter prompt.

Roman.




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