From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21682 invoked from network); 19 Aug 1998 18:05:38 -0000 Received: from math.gatech.edu (list@130.207.146.50) by ns1.primenet.com.au with SMTP; 19 Aug 1998 18:05:38 -0000 Received: (from list@localhost) by math.gatech.edu (8.9.1/8.9.1) id NAA09026; Wed, 19 Aug 1998 13:51:22 -0400 (EDT) Resent-Date: Wed, 19 Aug 1998 13:51:13 -0400 (EDT) From: "Bart Schaefer" Message-Id: <980819105343.ZM11457@candle.brasslantern.com> Date: Wed, 19 Aug 1998 10:53:43 -0700 In-Reply-To: Comments: In reply to "Stephen Riehm" "Re: zsh - new user with questions" (Aug 19, 5:09pm) References: X-Mailer: Z-Mail (4.0b.820 20aug96) To: zsh-users@math.gatech.edu Subject: Case insensitive completion (Re: zsh - new user with questions) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Resent-Message-ID: <"EqHRz1.0.KC2.G2nsr"@math> Resent-From: zsh-users@math.gatech.edu X-Mailing-List: archive/latest/1740 X-Loop: zsh-users@math.gatech.edu X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu On Aug 19, 5:09pm, Stephen Riehm wrote: } Subject: Re: zsh - new user with questions } } All that is required is that all routines that compare file names need } to convert both strings for comparison to lower (or upper) case before } comparison. Minor nit: It can't be _all_ routines that compare file names, because the files README ReadMe Readme readme and rEaDmE might all exist in the same directory. At some point you have to notice case to identify the one you really mean. Case-insenstive globbing is much more dangerous than case-insensitive completion, particularly given multios (where e.g. "echo foo > r*me" might clobber all five files). In any case (pun intended), here's a bit of a hack to make the multicomp function be case-insensitive in the ASCII set, including making `-' and `_' interchangable. It should be obvious how to add other mappings; for example, to equate comma and period, append :gs/,/./:gs/./.,/ There might be a simpler way to achieve this, but short of using process substitution I couldn't think of one. Index: Functions/multicomp =================================================================== --- multicomp 1998/06/01 17:08:43 1.1.1.1 +++ multicomp 1998/08/19 17:40:06 @@ -53,7 +53,17 @@ else wild='*' fi - reply=(${sofar}"${head}${wild}${globdir}") + + # Simulate case-insensitive globbing for ASCII characters + wild="[${(j(][))${(s())head:l}}]${wild}" # :gs/a/[a]/ etc. + # The following could all be one expansion, but for readability: + wild=$wild:gs/a/aA/:gs/b/bB/:gs/c/cC/:gs/d/dD/:gs/e/eE/:gs/f/fF/ + wild=$wild:gs/g/gG/:gs/h/hH/:gs/i/iI/:gs/j/jJ/:gs/k/kK/:gs/l/lL/ + wild=$wild:gs/m/mM/:gs/n/nN/:gs/o/oO/:gs/p/pP/:gs/q/qQ/:gs/r/rR/ + wild=$wild:gs/s/sS/:gs/t/tT/:gs/u/uU/:gs/v/vV/:gs/w/wW/:gs/x/xX/ + wild=$wild:gs/y/yY/:gs/z/zZ/:gs/-/_/:gs/_/-_/ + + reply=(${sofar}"${wild}${globdir}") reply=(${~reply}) fi -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com