Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: persistent, shared directory stack possible?
- X-seq: zsh-users 13304
- From: Ali Polatel <polatel@xxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: persistent, shared directory stack possible?
- Date: Sun, 5 Oct 2008 04:30:38 +0300
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:subject :message-id:references:mime-version:content-type:content-disposition :in-reply-to:user-agent; bh=DVI5LVXm7jg16KPABx3Y/xTukdeL/ot6E7oAKU/C2lE=; b=kUaJOQL8wB7WY3w12mB1ZdmqYltySp55XUU8t27gmKk5dnS1hDfhEf2TMEao/FhphU nnYpmT8XbiQIdY+zPhpc/04cxdvzp6SvQ87lCre/pRrArnMVcpTXfUzafF3c6ZzF49/z 1khkDhHUaDTff2UlWP5ar9LSgl1MnIiRiQxLc=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=JHyLgevP7m8bP/tybFWa76/IGUystcyDkMnSrlv9Cp1VvDz9cDvRfie6y9llYK3e3l Xp29O+f4+bZttBjs+SQKlNon6pF2uGh88SBhSnNCSltja8/+AUM4xZa+FNYrRYOWV4mw 248OWB2uOkBtE8Rvj6X/y+oBn/BUtQD/kmWfk=
- In-reply-to: <481d6b880810041727l6ec622fbq778b567a92cf2694@xxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <481d6b880810041727l6ec622fbq778b567a92cf2694@xxxxxxxxxxxxxx>
Eric P. Mangold yazmış:
> Hi,
>
> I'm looking for a way to transparently share a single directory stack
> between multiple instances of zsh in the same fashion as shared
> history.
>
> I note the zsh-workers thread here which raises the same question:
>
> http://www.zsh.org/mla/workers/2007/msg00691.html
>
> Has anyone implemented this yet?
Here's a snippet from my zshrc which does it, not sure if it's perfect
though.
DIRSTACKSIZE=32
DIRSTACKFILE="${HOME}"/.zdirs
autoload -U is-at-least
# Keep dirstack across logouts
if [[ -f ${DIRSTACKFILE} ]] && [[ ${#dirstack[*]} -eq 0 ]] ; then
dirstack=( ${(f)"$(< $DIRSTACKFILE)"} )
dirstack=( ${(u)dirstack} )
fi
# Make sure there are no duplicates
typeset -U dirstack
# Share dirstack between multiple zsh instances
function chpwd() {
if is-at-least 4.1; then # dirs -p needs 4.1
# Get the dirstack from the file and add it to the current dirstack
dirstack+=( ${(f)"$(< $DIRSTACKFILE)"} )
dirstack=( ${(u)dirstack} )
dirs -pl |sort -u >! ${DIRSTACKFILE}
fi
}
> -teratorn
>
--
Regards,
Ali Polatel
Attachment:
pgpVMUEGM1kwM.pgp
Description: PGP signature
Messages sorted by:
Reverse Date,
Date,
Thread,
Author