From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15599 invoked from network); 14 Sep 2003 18:58:33 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 14 Sep 2003 18:58:33 -0000 Received: (qmail 6407 invoked by alias); 14 Sep 2003 18:58:20 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 6575 Received: (qmail 6398 invoked from network); 14 Sep 2003 18:58:19 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 14 Sep 2003 18:58:19 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [4.64.232.255] by sunsite.dk (MessageWall 1.0.8) with SMTP; 14 Sep 2003 18:58:19 -0000 Received: (from schaefer@localhost) by candle.brasslantern.com (8.11.6/8.11.6) id h8EIwHA27559 for zsh-users@sunsite.dk; Sun, 14 Sep 2003 11:58:17 -0700 From: Bart Schaefer Message-Id: <1030914185817.ZM27558@candle.brasslantern.com> Date: Sun, 14 Sep 2003 18:58:17 +0000 In-Reply-To: <20030914103053.GA827@strindberg.student.uu.se> Comments: In reply to Jesper Holmberg "Case-insensitive completion" (Sep 14, 12:30pm) References: <20030914103053.GA827@strindberg.student.uu.se> X-Mailer: Z-Mail (5.0.0 30July97) To: Zsh-users List Subject: Re: Case-insensitive completion MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Sep 14, 12:30pm, Jesper Holmberg wrote: } } As I interpret the manual, the following lines: } } zstyle ':completion:*' completer _expand _complete _complete:jhcase _ignored } zstyle ':completion:*:jhcase:*' matcher-list 'm:{a-z}={A-Z}' } } would achieve what I want. However, now typing "cd ni" gives me only } "nik", and apparently "Nic" no longer matches. } } What am I missing? Completers are called in order until one of them succeeds. Because the _complete call found "nik", _complete:jhcase was never called. To get both kinds of patterns, you instead need to use a combination of several styles that can be rather bewildering: file-patterns and/or tag-order, to divide the matches into tagged groups; group-order and possibly group-name, for display ordering of the groups; matcher (not matcher-list), to control which matches are in which group. 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. - 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. - 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 '*'. 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.