zsh-users
 help / color / mirror / code / Atom feed
* Execute a command after each directory change
@ 2003-02-07 13:36 Jörg Ziefle
  2003-02-07 14:11 ` Le Wang
  0 siblings, 1 reply; 2+ messages in thread
From: Jörg Ziefle @ 2003-02-07 13:36 UTC (permalink / raw)
  To: zsh-users

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.

Joerg


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Execute a command after each directory change
  2003-02-07 13:36 Execute a command after each directory change Jörg Ziefle
@ 2003-02-07 14:11 ` Le Wang
  0 siblings, 0 replies; 2+ messages in thread
From: Le Wang @ 2003-02-07 14:11 UTC (permalink / raw)
  To: Jörg Ziefle, Zsh users list

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=us-ascii, Size: 756 bytes --]

 --- Jörg Ziefle <ziefle@ifd.mavt.ethz.ch> 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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-02-07 14:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-07 13:36 Execute a command after each directory change Jörg Ziefle
2003-02-07 14:11 ` Le Wang

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).