zsh-users
 help / color / mirror / code / Atom feed
From: Tomasz Pala <gotar@polanet.pl>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: zsh-users@zsh.org
Subject: Re: cd /u/N/v/ tab expansion
Date: Sun, 10 Apr 2022 16:32:22 +0200	[thread overview]
Message-ID: <20220410143222.GA21848@polanet.pl> (raw)
In-Reply-To: <20220410010441.GA24829@polanet.pl>

On Sun, Apr 10, 2022 at 03:04:41 +0200, Tomasz Pala wrote:

> I've stuck with this problem month ago...
> 
> $ cd /e/s/s/[tab]
> No matches for: `directory'

This happens with: setopt glob_complete interfering with

zstyle ':completion:*' list-dirs-first true

According to the docs this should not be correlated.
For me it seems that list-dirs-first is somehow broken. I got other
usecases with bogus sets in menu completion.

Namely:

$ mkdir -p usr/{share/{aclocal,atever},sbin,src}
$ touch usr/sbin/a1 usr/share/a1 usr/share/a2
$ zstyle ':completion:*' list-dirs-first true

$ ls u/s*/a[tab]
directory
aclocal/  atever/

after second tab:
directory
aclocal/  atever/
files
a1        a2

- the problem is there is only ONE a1 file proposed and this is
usr/share/a1, usr/sbin/a1 doesn't get to the list at all!
Or it's overaggregated (disregarding directory).


$ ls u/s*/a*[tab]	note the asterisk after "a"
directory
aclocal/  atever/
files
sbin/     share/

- this is much better, as sbin/ and share/ are completed to "sbin/a*"
and share/a*, so after the initial selection one can start second
completion resolving "a*" part.


My solution was to use:

zstyle ':completion:*:*:*:*' list-suffixes yes

but then:

$ mkdir -p  a/{b1,b2}/d/{e1,e2}/g
$ ls a/b/d/e/g[tab]
No matches for: `files' or `directory'

And after:
$ zstyle ':completion:*' list-dirs-first false
$ ls a/b/d/e/g[tab]
No matches for: `files'

- slightly different response only.


This behaviour also doesn't match the docs - enabling list-suffixes
should cause all ambiguous components to be shown. Apparently it does
the opposite (!)


Therefore - list-dirs-first breaks some cases and my solution breaks
others. Without both of them:

$ ls u/s*/a[tab]	note the asterisk after "s", i.e. any glob
No matches for: `files'


So, assuming list-dirs-first is simply broken (and it should only result
in different ordering of matches, completion of u/s*/a is apparently
some side effect only), what should be the correct way to complete

$ u/s*/a[tab]	into:
directory
share/aclocal/  share/atever/
files
sbin/a1         share/a1        share/a2

?


BTW this might be related to my previous thread:
"_complete: insert unambiguous when globbing"

-- 
Tomasz Pala <gotar@pld-linux.org>
-4500 s


  reply	other threads:[~2022-04-10 14:33 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-06 12:40 zzapper
2022-04-07 20:11 ` Bart Schaefer
2022-04-07 20:20   ` zzapper
2022-04-07 23:11     ` Bart Schaefer
2022-04-08  9:53       ` zzapper
2022-04-08 17:57         ` Bart Schaefer
2022-04-08 10:22       ` david rayner
2022-04-08 18:09         ` Bart Schaefer
2022-04-10  1:04       ` Tomasz Pala
2022-04-10 14:32         ` Tomasz Pala [this message]
2022-04-10 16:27           ` Tomasz Pala
2022-04-10 16:32             ` Tomasz Pala
2022-04-10 17:45               ` Tomasz Pala
2022-04-10 18:05                 ` Tomasz Pala
2022-04-16 14:17                   ` Tomasz Pala
2022-04-17  3:00           ` Bart Schaefer
2022-04-17 16:17             ` Tomasz Pala
2022-04-17 18:15               ` Bart Schaefer
2022-04-17 18:44                 ` Bart Schaefer
2022-04-17 18:32               ` Bart Schaefer

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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

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

  git send-email \
    --in-reply-to=20220410143222.GA21848@polanet.pl \
    --to=gotar@polanet.pl \
    --cc=schaefer@brasslantern.com \
    --cc=zsh-users@zsh.org \
    --subject='Re: cd /u/N/v/ tab expansion' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Code repositories for project(s) associated with this inbox:

	https://git.vuxu.org/mirror/zsh/

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