Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Problem with the redefinition of "cd" command.
- X-seq: zsh-workers 3483
- From: Andrew Main <zefram@xxxxxxxxx>
- To: agn@xxxxxxxxx (Andres Gomez Navarro)
- Subject: Re: Problem with the redefinition of "cd" command.
- Date: Thu, 11 Sep 1997 13:14:56 +0100 (BST)
- Cc: zsh-workers@xxxxxxxxxxxxxxx, aj.gomez@xxxxxxxxxxxx
- In-reply-to: <01BCBEDB.1274EFE0@xxxxxxxxxxxxxx> from "Andres Gomez Navarro" at Sep 11, 97 05:49:35 pm
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