Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Execute a command after each directory change
- X-seq: zsh-users 5889
- From: Le Wang <lewang@xxxxxxxxx>
- To: "Jörg" Ziefle <ziefle@xxxxxxxxxxxxxxxx>, Zsh users list <zsh-users@xxxxxxxxxx>
- Subject: Re: Execute a command after each directory change
- Date: Fri, 7 Feb 2003 09:11:17 -0500 (EST)
- In-reply-to: <20030207133627.GA21183@xxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
--- Jörg Ziefle <ziefle@xxxxxxxxxxxxxxxx> wrote: > Hello,
>
> I would like to execute a command (i.e. ls) whenever the CWD changes.
> Of course it could be done by redefining ls, popd and pushd. But there
> is probably a more elegant solution which accounts for a general
> directory change.
I have in my zshrc:
chpwd() {
local result path
[[ -t 1 ]] || return
case $TERM in
sun-cmd)
print -Pn "\e]l%~\e\\"
;;
*xterm*|rxvt*|(dt|k|E)term)
path=$(print -Pn "%~");
if [ $LE_CYGWIN ]; then
cygpath-m $path
path=$result
fi
print -Pn "\e]2;${path}@${HOST}\a"
;;
esac
}
hth.
--
Le
______________________________________________________________________
Post your free ad now! http://personals.yahoo.ca
Messages sorted by:
Reverse Date,
Date,
Thread,
Author