Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: cd /u/N/v/ tab expansion



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@xxxxxxxxxxxxx>
-4500 s




Messages sorted by: Reverse Date, Date, Thread, Author