help / color / mirror / code / Atom feed
From: Oliver Kiddle <opk@zsh.org>
To: zsh-workers@zsh.org
Cc: Sebastian Stark <sstark+zsh@mailbox.org>
Subject: Re: Separate cdpath elements in path-directories completion
Date: Sun, 19 Feb 2023 17:51:22 +0100	[thread overview]
Message-ID: <80615-1676825482.916080@qR5n.Nmed.T67B> (raw)
In-Reply-To: <20230219100217.f2mcniygwgbtxvwf@singold.localdomain>

[ 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?


       reply	other threads:[~2023-02-19 16:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20230218211046.vj3p4k7y6uraytpo@singold.localdomain>
     [not found] ` <CAH+w=7bhjyXVgMb7esyg-1n0SbBAZogUrCVg34wFB64z3aUimg@mail.gmail.com>
     [not found]   ` <20230219100217.f2mcniygwgbtxvwf@singold.localdomain>
2023-02-19 16:51     ` Oliver Kiddle [this message]
2023-02-20  3:54       ` Bart Schaefer
2023-02-21 22:12       ` Sebastian Stark
2023-02-24 12:57         ` Oliver Kiddle

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:

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

  git send-email \
    --in-reply-to=80615-1676825482.916080@qR5n.Nmed.T67B \
    --to=opk@zsh.org \
    --cc=sstark+zsh@mailbox.org \
    --cc=zsh-workers@zsh.org \


* 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


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).