zsh-users
 help / color / mirror / code / Atom feed
From: "Bart Schaefer" <schaefer@brasslantern.com>
To: Le Wang <lewang@yahoo.com>, Zsh users list <zsh-users@sunsite.dk>
Subject: Re: merging consecutive cd commands
Date: Sun, 6 Jan 2002 05:32:12 +0000	[thread overview]
Message-ID: <1020106053212.ZM7648@candle.brasslantern.com> (raw)
In-Reply-To: <20011222235104.84129.qmail@web12303.mail.yahoo.com>

On Dec 22,  6:51pm, Le Wang wrote:
} 
} Is there an option that allows consecutive cd or pushd
}  commands to modify the top entry in the cd stack

That would be what happens when autopushd is not set, wouldn't it?

} and command history, instead of adding to it?

There's currently no option or other mechanism that allows altering an
existing history entry (unless you count hist_ignore_space).  We've
talked about making editable the $history association, but haven't come
up with a working solution yet.

} e.g.
} ---------------------------
} LE-XP% setopt autopushd
} LE-XP% cd temp
} LE-XP% cd temp2
} LE-XP% dirs
} ~/temp/temp2 ~
} LE-XP%
} ---------------------------

I suspect that what you mean is that you want autopushd only when NOT
changing to a subdirectory of the current directory.  You can simulate
that with something like this:

    chpwd() {
      # setopt localoptions pushd_silent no_pushd_minus # as needed
      [[ ~0 = ~1/* ]] && popd +1
    }

Or you can manipulate the $dirstack array if you have the zsh/parameter
module loaded:

    chpwd() {
      # setopt localoptions no_ksh_arrays # if needed
      [[ $PWD = $dirstack[1]/* ]] && dirstack[1]=()
    }

Or you can write your own cd and/or chdir functions and do it in those.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


      reply	other threads:[~2002-01-06  4:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-12-22 23:51 Le Wang
2002-01-06  5:32 ` Bart Schaefer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1020106053212.ZM7648@candle.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=lewang@yahoo.com \
    --cc=zsh-users@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).