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

Re: show command in XTERM titlebar like function chpwd()



heiko_elger@xxxxxxxxxx wrote:
>     is it possible to use own functions (like run-help) with the bindkey 
>     command?

It is now (3.1.2).

>     I want to update my XTERM title bar every time I'll press then ENTER 
>     key. I want to have the command name which is executing in the title 
>     bar.

The best way to do this is not to bind a new function to ENTER, but to
redefine accept-line:

accept-line () {
  local cmd=${BUFFER%%" "*}
  [[ -n "$cmd" && $TERM == xterm* ]] && print -nR "executing: $cmd"
  zle .accept-line
}
zle -N accept-line

Replace the print argument with whatever sequence is required for the xterm
titlebar.

-zefram



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