From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5886 invoked from network); 16 Sep 2003 17:04:22 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 16 Sep 2003 17:04:22 -0000 Received: (qmail 9656 invoked by alias); 16 Sep 2003 17:03:57 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 6586 Received: (qmail 9645 invoked from network); 16 Sep 2003 17:03:57 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 16 Sep 2003 17:03:56 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [4.64.232.255] by sunsite.dk (MessageWall 1.0.8) with SMTP; 16 Sep 2003 17:3:56 -0000 Received: (from schaefer@localhost) by candle.brasslantern.com (8.11.6/8.11.6) id h8GH3sW30177 for zsh-users@sunsite.dk; Tue, 16 Sep 2003 10:03:54 -0700 From: Bart Schaefer Message-Id: <1030916170354.ZM30176@candle.brasslantern.com> Date: Tue, 16 Sep 2003 17:03:54 +0000 In-Reply-To: <20030915190817.GA582@strindberg.student.uu.se> Comments: In reply to Jesper Holmberg "Re: Case-insensitive completion" (Sep 15, 9:08pm) References: <20030914103053.GA827@strindberg.student.uu.se> <1030914185817.ZM27558@candle.brasslantern.com> <20030915190817.GA582@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 15, 9:08pm, Jesper Holmberg wrote: } Subject: Re: Case-insensitive completion } } aac.txt aAa.txt Aaa.txt aAb.txt } } If I want to complete for "Aaa.txt", it works well, I just put capital "A" } and hit tab, and since the matching is only one-way, the completer knows } that I really want a capital A, and gives me Aaa.txt. } } If, on the other hand, I wanted aac.txt, hitting "aa" would not really } help me, since "aAa.txt", "Aaa.txt" and "aAb.txt" would all be proposed } before my aac.txt. I am thus looking for an easy way to specify that } *this time* I really want to match on literally "aa". } } Perhaps what I want is unachievable, but has anyone solved this in a smart } way? Normally the way to do that would be to use different keybindings for "complete case-insensitively" vs. "complete case-sensitively" and tell zsh your preference by which of them you invoke. Start with zstyles something like this: zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}' zstyle ':completion:*:case-sensitive:*' matcher-list '' zstyle ':completion:*' completer _expand _complete _ignored Then, in a file (name doesn't matter much) somewhere in the path where compinit looks for completion functions, you put: ---- 8< ---- snip ---- 8< ---- #compdef -k complete-word \C-xI _main_complete _expand _complete:case-sensitive _ignored ---- 8< ---- snip ---- 8< ---- Replace \C-xI (control x shift i) with whatever keybinding you want to have attached to case-sensitive completion. You could get a little fancier with the function and avoid hardwiring the list of completers by copying some of the code from _main_complete to get the matcher-list context, then modify that list of matchers to attach :case-sensitive where needed, before calling _main_complete. Warning, I didn't actually test any of the above.