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 14600 invoked from network); 19 Feb 2023 10:03:12 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 19 Feb 2023 10:03:12 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1676800992; b=khzjY/+VcyVOtaat1ev6au5HD9csG0Rt/U3kdaNyEQOUuhkeMiiTM3ft9FHIGfDr9gqGu8D2a9 /B0Dw2TG+K95LlOL8WEU8Y9oWG6FhSpitjQuBYpdDCwUjudZPM53OdvMELeE/6/D6iecP2iNz/ tMLxYFgmbUNPMHkwaS98v7w5vdNpFihUXYj+FVzm1/v9X6lx8mf+z/KfN17LWvip/1XeRHIDTu Sw7g/5RXnNc5QyjAy7lRGRaRNNOatjgSlx0/ePyo4oB4n6BdbM10kXhjn3sq4gUV4IeqNmh+E5 jeEE3fOGTM2TcNkQFJACCL/Soi7F70zHXhseD7zfOS5PAQ==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mout-p-102.mailbox.org) smtp.remote-ip=80.241.56.152; dkim=pass header.d=mailbox.org header.s=mail20150812 header.a=rsa-sha256; dmarc=pass header.from=mailbox.org; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1676800992; bh=B6pEwi7++sYTOSbK1s8THf99vFKKWsqsVjrjVsn79fM=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:DKIM-Signature:DKIM-Signature; b=AlYQpondh8BbDz5AYU9VCnEmPTJWI4cNbFD5+XcVFsS/X21NVdjWltPIyc2cBUS+IZb/BVz8vt 5Jz+Wiah+rWRMWYIV5wUBOMdYja7QBwXzHLlNMOrMaUxIT7tCAqKpa3Vu0sQJAUQ3YLNgroaRd EQmd3x8H4GZPYF4ur6+E7h/QYGJfBMCe+DLwucjjugvKSsBDrcZfdIzVDNx7O+rX+4N6xvDZ7Y Ga/5mm3kbPOc4OCNuB/ntFhRZnOXrp7wn+BQViR2F4GeS75anLOJoT8MMSaWEYiQ1+Wl3ljLTO 06tlxP3yResMW2nNekyHFPUJHaqK/ftkztm5EIbVjfqTPA==; 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:In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=+kviMuzhlMu5090nIu5PJXQaOw59WHn4Aa812UNuI+c=; b=CoV/uQDOR8sPe5tOShGLniUVSu rqt3AaiD1wKd/Uz2+KgdXrWpsYLM/J7ksxNxIAgfYDgi4ZkZ7+H5s/EhcFe19lIqmvslUtQOP3P7L +amiD1BWB+EollFekFFgi6Pzb3sKGJBbKgeqstsJtie6IXGdbla3n2hzzR23YuPK8g1PnMPZugUpC iqzbdUlwhaGRnH9/KaVSEY8DZ9yP+CloySHjshNpad/q6xh77FfnWIRjvthqJjPrqP9gUc2C2DWvo EXNviK5UUIILotw/MBtGp2MC3a9qcNia5JJn3h123IegEh3tsM3YjA/e4mB+ntFwySouJQXqwrqF4 Vb5vyRXg==; Received: by zero.zsh.org with local id 1pTgXH-000JTr-0d; Sun, 19 Feb 2023 10:03:11 +0000 Authentication-Results: zsh.org; iprev=pass (mout-p-102.mailbox.org) smtp.remote-ip=80.241.56.152; dkim=pass header.d=mailbox.org header.s=mail20150812 header.a=rsa-sha256; dmarc=pass header.from=mailbox.org; arc=none Received: from mout-p-102.mailbox.org ([80.241.56.152]:52696) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1pTgWV-000In2-QJ; Sun, 19 Feb 2023 10:02:24 +0000 Received: from smtp102.mailbox.org (smtp102.mailbox.org [10.196.197.102]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-102.mailbox.org (Postfix) with ESMTPS id 4PKLgv4j6nz9sbn; Sun, 19 Feb 2023 11:02:19 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mailbox.org; s=mail20150812; t=1676800939; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=+kviMuzhlMu5090nIu5PJXQaOw59WHn4Aa812UNuI+c=; b=kzXEoIUWZUZI/je2E1E7tjYzSe/W/UFeINJVwvqFvKVdRr8ujGroAZZF9jB4WKN0RLceQC cztWK+Wr3RTbTUNfbXQoXp2R/gZ7o/KsgvYXJwF3JaEIx8EaosabdkxXuJP3+eNOuCpv6n WMRLwmH7ogcK+Yjrio4BOc/33gNFwzc5V1OQxet+HGh+kNw9oTcZG/80u6v36iv3UmD46n J+pwrfCmVo7Llknj77Y8qRLIahmUrwNDTL4F/FFwO/P09rxiriy++yIQkrEd2B5rn3CMKM ILhOGpoMfvKbk/Y6VNFCqn3objJs6VFgJFC72cbGPIfAOBmw2RbC8DMQjWEN9Q== Date: Sun, 19 Feb 2023 11:02:17 +0100 From: Sebastian Stark To: Bart Schaefer Cc: zsh-users@zsh.org Subject: Re: Separate cdpath elements in path-directories completion Message-ID: <20230219100217.f2mcniygwgbtxvwf@singold.localdomain> Mail-Followup-To: Bart Schaefer , zsh-users@zsh.org References: <20230218211046.vj3p4k7y6uraytpo@singold.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Disposition: inline In-Reply-To: X-MBO-RS-ID: 9210583fc090c02f858 X-MBO-RS-META: ymhj9thkt8tagtkahmi3ty1igwrx9se4 X-Seq: 28948 Archived-At: X-Loop: zsh-users@zsh.org Errors-To: zsh-users-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-users-request@zsh.org X-no-archive: yes List-Id: List-Help: , List-Subscribe: , List-Unsubscribe: , List-Post: List-Owner: List-Archive: Am Sonntag, den 19. Februar 2023 um 00:05 schrieb Bart Schaefer: >On Sat, Feb 18, 2023 at 1:11 PM Sebastian Stark wrote: >> >> Is it possible to show a separate completion section for each element in >> $cdpath? > >You would have to arrange that each directory's name becomes a tag >(the "path-directories:" part in the alt= assignment) and call >"_path_files -W" separately for each directory. There's no existing >shortcut for this. 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. --- /usr/share/zsh/functions/Completion/Zsh/_cd 2023-02-08 23:22:07.000000000 +0100 +++ .zfunc/_cd 2023-02-19 10:51:50.263265022 +0100 @@ -70,8 +70,15 @@ tmpcdpath=(${${(@)cdpath:#.}:#$PWD}) - (( $#tmpcdpath )) && - alt=( 'path-directories:directory in cdpath:_path_files -W tmpcdpath -/' ) + if zstyle -t ":completion:${curcontext}:directories" cdpath-sections; then + local elem + for elem in $tmpcdpath; do + alt+=( "path-directories-$elem:$elem:_path_files -W $elem -/" ) + done + else + (( $#tmpcdpath )) && + alt=( 'path-directories:directory in cdpath:_path_files -W tmpcdpath -/' ) + fi # With cdablevars, we can complete foo as if ~foo/ if [[ -o cdablevars && -n "$PREFIX" && "$PREFIX" != <-> ]]; then Sebastian