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

Re: Getting xterm title bar to display last command...

Zoltan Hidvegi <hzoli@xxxxxxxxxxxxxxxxxxx> writes:

> > Okay, so I have the neat function from the zsh web site to get my xterm to
> > display the current directory....Anyone know how to use that basic idea to
> > get my xterm to display the last thing entered at the command line
> > instead?
> In zsh-3.1.2 (coming soon), thanks to Zefram, you can do:
> zle -N my-accept-line
> my-accept-line () { print -nr -- "^[]2;$BUFFER^G"; zle accept-line; }
> bindkey '^M' my-accept-line
> Note that you have to type real ESC and CTRL-G instead of ^[ and ^G.  In
> zsh-3.0, and probably in zsh-3.1.1 too, there is no way to do that.
> Zoltan

My colorized listing and postprompt patch does this for Zsh-3.0.2.  You
set PPTMOUT to the number of seconds to wait before displaying the
string, and set POSTPROMPT to the string to display (including the
escape characters).

Note that this has the advantage that only commands that are running for
a certain length get displayed.  It has the disadvantage of the
possibility (very very rare when you use an xterm control sequence) of
mixing output with the running program. (not a problem if running
program sends output to a file).

See the patches on my web page, ../gjb/patches

Greg J. Badros
Seattle, WA  USA

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