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

Re: Problem with the redefinition of "cd" command.



Andres Gomez Navarro wrote:
>alias cd 'set ul=$cwd; chdir \!*;set prompt=$cwd"~>"'

A direct translation is

function cd {
  ul=$PWD
  chdir $@
  PROMPT="$PWD~>"
}

but there are some zsh features that make this easier.  The shell variable
$OLDPWD is always automatically set to the previous directory visited,
so your $ul is unnecessary.  Also, a magic sequence in the prompt can
expand to the current directory, without having to change it all the time.
So what you want, idiomatically, is

PROMPT="%/~>"

or you could replace "%/" with "%~" to have the directory abbreviated
using ~ sequences.

-zefram



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