From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 31305 invoked from network); 19 Feb 2023 16:51:57 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 19 Feb 2023 16:51:57 -0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Message-ID:Date:Content-ID: Content-Type:MIME-Version:Subject:To:References:From:In-reply-to:cc:Reply-To: Content-Transfer-Encoding:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=yQOQ36uTe5CQbZeQ1bJ30Jb7KBCFOmR47BUBLvrALHc=; b=Wq3goWDmmN40vRQ449+xk5vVlu fbS/gikKCZ3aYvxWlJTi2/laXzUI7jvcXxlwL+HPLcYxWSiyd+v/H90Ba9ne5Zp0lT2p+PmfnaYlh cskSveVpFfOc/koQnowCOJrTrBh+nPB9Tanz/CfwZ9OoqxQqbcfy3Us7rvuSPyuT8pPPUxJiIaCV3 BFvLKmjxUKy/XXWM41T2OSK/ofh5ittKzuRwJJIAh/ey+GUaGd/X0VmSLPyG9qfwBA/KGQ4OEMJwK W+WsjruT+TS2p41x09Ak9NP/aPVpxCcPgdSP6r2/FEbpB2mvI4HJx3DS9rkYJxAEx9VNUNfbQm2zv Qg3A2IFg==; Received: by zero.zsh.org with local id 1pTmuq-0003yc-Lx; Sun, 19 Feb 2023 16:51:56 +0000 Received: by zero.zsh.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1pTmuJ-0003eb-Bx; Sun, 19 Feb 2023 16:51:23 +0000 Received: from [192.168.178.21] (helo=hydra) by mail.kiddle.eu with esmtp(Exim 4.95) (envelope-from ) id 1pTmuI-000KyG-Tg; Sun, 19 Feb 2023 17:51:23 +0100 cc: Sebastian Stark In-reply-to: <20230219100217.f2mcniygwgbtxvwf@singold.localdomain> From: Oliver Kiddle References: <20230218211046.vj3p4k7y6uraytpo@singold.localdomain> <20230219100217.f2mcniygwgbtxvwf@singold.localdomain> To: zsh-workers@zsh.org Subject: Re: Separate cdpath elements in path-directories completion MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <80614.1676825482.1@hydra> Date: Sun, 19 Feb 2023 17:51:22 +0100 Message-ID: <80615-1676825482.916080@qR5n.Nmed.T67B> X-Seq: 51462 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: , List-Subscribe: , List-Unsubscribe: , List-Post: List-Owner: List-Archive: [ moving to -workers and cc: Sebastian ] Sebastian Stark wrote: > Thanks for showing me the right direction. I ended up with the > following, in case somebody wants that feature too. I can control the > behaviour by adding > > "zstyle ':completion:*:directories' cdpath-sections true" > > to my config. I realise that you posted this "in case somebody wants that feature too" rather than as an explicit contribution but if we include this in the distributed _cd, it'd be rather easier to use. For that, there's a couple of changes I would suggest: cd completion otherwise uses the tag "path-directories" for directories from $CDPATH. It is always better if you can vary the context but reuse an existing style name. In this case, the separate-sections style would be appropriate. This would then need to be: zstyle ':completion:*:path-directories' separate-sections true Also, I would probably suggest expanding the description to "directory in $elem" instead of just "$elem" as here: > + alt+=( "path-directories-$elem:$elem:_path_files -W $elem -/" ) > + done > + else > + (( $#tmpcdpath )) && > + alt=( 'path-directories:directory in cdpath:_path_files -W tmpcdpath -/' ) I'm also unsure about including $elem in the tag. It will probably work fine but doesn't exactly conform with usual tag naming conventions. Perhaps just an index for the position in the cdpath array. Does anyone else have an opinion on that? Oliver