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

Re: Case-insensitive completion



Bart wrote:

> This is a start at it:
> 
> -------
> zstyle ':completion:*:ci-globbed-files' matcher 'm:{a-z}={A-Z}'
> zstyle ':completion:*' file-patterns \
>   '(#I)%p:globbed-files %p:ci-globbed-files' '*:all-files'
> zstyle ':completion:*' group-order globbed-files ci-globbed-files all-files
> zstyle ':completion:*' group-name ''
> -------
> 
> The difficulties are:
> 
> - It may work differently when completing in default context than when
>   completing after a command such as "ls" that has its own completion
>   function defined.  E.g., "ls" somehow ignores the globbed-files group
>   and goes directly to ci-globbed-files, I don't know why.

Problem is related to nested tag loops and the old problem of ordering
of options passed down versus those determined further down.

In this case, all matches are going into an argument-rest group thanks
to _arguments and the more specific group names get ignored. I can't
see a way round it using styles because you can't avoid the -default-
group.

Not easy to solve more generally either. Long term we probably need to
keep track of the whole chain of tags used along the way.

> - It's quite difficult to express the concept "only files that match
>   case-insensitively, not those that match case-sensitively."  Thus the
>   ci-globbed-files group is a superset of globbed-files and you get a
>   redundant listing.

This is a bit unfortunate. Matching control probably needs a way to
specify that only matches which needed the rule should be matched.
Handling ordering for pure menu completion users is simply something
which was never particularly considered.

> - file-patterns are not tried after the first one that has the pattern
>   '*:...' which is why the (#I) is thrown in on globbed-files, to force
>   attempting both globbed-files and ci-globbed-files even if the match
>   pattern substituted by %p is '*'.

Yuk. Could you see if there was a good reason for that? If it is just
for efficency it should perhaps be removed. Will fall down with other
styles like ignored-patterns and ignore-line.

> Also note that there was at least one dev release where %p was not
> handled properly.  I don't recall whether 4.0.7 has that bug.  I tried
> the above only with the current CVS incarnation of 4.1.1-dev-1.

I think that bug is in 4.0.7 which is quite bad really.

Oliver



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