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

Re: Zsh "POSTPROMPT" Feature



"Greg J. Badros" <gjb@xxxxxxxxxxxxxxx> wrote:
>  One feature that I've not seen talked about but that would be useful
>(mostly in an X environment) is the addition of a POSTPROMPT variable.  I
>have patches for zsh-2.5.03 that implement this, and then my .zshrc sets 
>my POSTPROMPT to
>{%^[]0;%H^G%}
>(Where ^[ is ESC, ^G is Ctrl-G-- the xterm sequence for setting the title
>and icon). [The %H is a change to print the last/current history item].

Well, if you just want to keep track of your current directory in your title bar, there's no need to patch zsh...For a start it's a little more efficient to only change your xterm title when you need to - ie. when you change directory - this can be done with the "chpwd" function, like so :

chpwd () {
        local dir=`print -D ${PWD}`
        local title=${LOGNAME}@$(uname -n):$dir
        print -n -D -P "\033]2;${title}\007"
}

Enjoy,
 Andrew.
-- 
 - Andrew J Cosgriff - ajc@xxxxxxxxxxxxxxxxx -          Mobile : +61-14-856-122
 SysAdmin / Support Dude, UNICO Computer Systems    PGP & MIME ok and preferred
                        "Your future is encoded in Pi."






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