From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 76 invoked by alias); 23 Feb 2018 08:07:15 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: List-Unsubscribe: X-Seq: 23163 Received: (qmail 14039 invoked by uid 1010); 23 Feb 2018 08:07:14 -0000 X-Qmail-Scanner-Diagnostics: from bart.luffy.cx by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(78.47.78.131):SA:0(-1.9/5.0):. Processed in 9.196896 secs); 23 Feb 2018 08:07:14 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_PASS, T_DKIM_INVALID,T_RP_MATCHES_RCVD autolearn=ham autolearn_force=no version=3.4.1 X-Envelope-From: bernat@luffy.cx X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=luffy.cx; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=postfix; bh=T6N/ofzcthclFnqpiZviRHq76VA=; b=se0 dp6m4bChCTA84f6DcVQEzYs6zzBK9fb6iw4+RRKLeNJLNHzz1EQ5FtT5SSdWX/cC Hj12Ls71f92lWA1ckxa0HXg5SirY4RFByiduke/I2eYfXeNUU0fqN34tSKUpcgBt NXxWjfT72JsfUdm3G7FTSFlvC6aMiHyjz2B16csU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=luffy.cx; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; q=dns; s=postfix; b=DQAe921CC3VtPYmhudxm2LHRH58Rg MIX+Ukr33WazalltD6viDhtKdjsuV0k48JakEWPZbQ0cFEooH62SIAUn4dbZ+ifJ T4kSuDGyjy9/ZbfHG/rowLEfeSHCi+f14JD/b5D25VhX1iwL14kLgBjb+vQq2wad 4MV/+gnobXtlzg= From: Vincent Bernat To: Scott Frazer Cc: zsh-users@zsh.org Subject: Re: Dynamic named directories and completion References: Date: Fri, 23 Feb 2018 09:01:11 +0100 In-Reply-To: (Scott Frazer's message of "Thu, 22 Feb 2018 17:54:24 -0500") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable =E2=9D=A6 22 f=C3=A9vrier 2018 17:54 -0500, Scott Frazer =C2=A0: > zsh_directory_name () > { > emulate -L zsh > setopt extendedglob > local -a seg; > seg=3D(${(s:/:)PWD%/*}) > if [[ $1 =3D n ]]; then > typeset -ga reply > reply=3D( /${(j:/:)seg[1,(I)$2]} ) > elif [[ $1 =3D c ]]; then > local expl > _wanted values expl 'parent dirs' compadd -S\] -a seg > else > return 1 > fi > return 0 > } > > Suppose I am in directory /aaa/bbb/ccc/ddd/eee and want to go up to direc= tory > ccc and then down into another directory. If I do: > > cd ~[c > > it correctly completes to: > > cd ~[ccc] > > If I hit enter at this point I go to /aaa/bbb/ccc. So far so good. If I > try to start completion, like so: > > cd ~[ccc]/ > > zsh doesn't give me options for directories under ccc, it thinks '/' is > the command I'm trying to complete. Is there a way to make this work? I don't see anything wrong in your code and for me, it works as you expect (zsh 5.4.2). Does "echo ~[ccc]" returns the right value? --=20 This was the most unkindest cut of all. -- William Shakespeare, "Julius Caesar"