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

Re: zsh prompt not updating until first 'chdir'




On May 1, 2004, at 7:32 PM, Dan Nelson wrote:

In the last episode (May 01), Timothy J. Luoma said:
Just back on the list after a long absence (exiled to Windows for a
few years, just bought a Mac).

There is a very nice cygwin port of zsh :)

Sssh!!  It was one of the reasons I said I had to get a Mac ;-)

Actually I just installed Cygwin not too long ago, but it just made me want to get a real Unix machine again.


I'm very rusty on my ZSH skills, and hope someone can help.  I have a
$PROMPT setup in .zshenv

setprompt () { PROMPT="

---------------------------------%t/%T ---------------------------------
%S[OLDPWD: $OLDPWD]
     [PWD: %~]%s
$SHORT_HOST> "
}

Why not just set PROMPT to

"
---------------------------------%t/%T ---------------------------------
%S[OLDPWD: $dirstack[1]]
     [PWD: %~]%s
$SHORT_HOST> "

in your .zshrc directly, setopt prompt_subst, and forget about
resetting it every time you cd?

PROMPT="
---------------------------------%t/%T ---------------------------------
%S[OLDPWD: $dirstack[1]]
     [PWD: %~]%s
$SHORT_HOST> "

works great EXCEPT that OLDPWD doesn't get updated

TjL



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