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

Re: Expansions with glob_complete ignore no_case_glob



Peter Stephenson wrote:
> Christian Taylor wrote:
> > With glob_complete set, the menu-completion of a glob pattern should
> > contain the same matches that would be inserted if glob_complete was not
> > set (except that a '*' is added at the end of the pattern). However, the
> > menu-completion always globs case-sensitive, even if no_case_glob is set.
>
> Yes, this is deliberate for patterns.  As you've spotted, glob_complete
> doesn't do filename generation.  This means NO_CASE_GLOB doesn't apply:
> [...]
> To control case-sensitivity in completion you need to use the more
> sophisticated "match control" feature:
>
> zstyle ':completion:*' matcher-list '' 'm:{a-zA-Z}={A-Za-z}'

I'm sorry, I forgot to mention that a similar line is already included in 
my .zshrc:
zstyle ':completion:*' matcher-list 'm:{a-zA-ZäöüÄÖÜ}={A-Za-zÄÖÜäöü}'
This works fine for all normal completions.

Reading my post again, I realize that I should have been more clear on what 
exactly I observed. The thing that suprised me originally is that for 
instance wildcards apparently cause the pattern to be completed by a 
mechanism that both ignores NO_CASE_GLOB and the matcher-list configuration. 
Here is an example in an empty directory:

% touch AbCd aBcD abcd
% ls abc(.)<TAB>
AbCd aBcD abcd [listed for completion]

As soon as there are wildcards or "^" in the pattern, it becomes case 
sensitive:

% ls a?c(.)<TAB>
aBcD abcd [listed for completion, instead of all files]
% ls a^k(.)<TAB>
(same)
% ls a*(.)<TAB>
(same)
% ls a*~*cd(.)<TAB>
[aBcD gets inserted, instead of no match]

If I understand the documentation I've read correctly, the matcher-list 
configuration does not apply here because it is not used if the command line 
contains a glob pattern and the GLOB_COMPLETE option is set. It is also not 
used by the _match function, which I suppose handles this completion. Is 
there an easy way to do case insensitive completion nonetheless?
I realize that I should just read through the whole documentation on the 
completion system to get an understanding for it, but I hope you can maybe 
direct me to a specific section again to accomplish this.
Thank you either way!

Christian Taylor



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