From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2303 invoked from network); 7 Oct 2004 01:42:37 -0000 Received: from ns2.primenet.com.au (HELO primenet.com.au) (?3MdBtDQFKae5ELgcm8iJ4dqUGHjWypqV?@203.24.36.3) by ns1.primenet.com.au with SMTP; 7 Oct 2004 01:42:37 -0000 Received: (qmail 19277 invoked from network); 6 Oct 2004 16:05:27 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by proxy.melb.primenet.com.au with SMTP; 6 Oct 2004 16:05:27 -0000 Received: (qmail 49428 invoked from network); 6 Oct 2004 16:04:19 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 6 Oct 2004 16:04:19 -0000 Received: (qmail 6459 invoked by alias); 6 Oct 2004 16:04:09 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 8041 Received: (qmail 6445 invoked from network); 6 Oct 2004 16:04:07 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 6 Oct 2004 16:04:07 -0000 Received: (qmail 48432 invoked from network); 6 Oct 2004 16:04:07 -0000 Received: from moonbase.zanshin.com (64.84.47.139) by a.mx.sunsite.dk with SMTP; 6 Oct 2004 16:04:04 -0000 Received: from toltec.zanshin.com (toltec.zanshin.com [64.84.47.166]) by moonbase.zanshin.com (8.13.1/8.13.1) with ESMTP id i96G3fRP022783; Wed, 6 Oct 2004 09:03:41 -0700 Date: Wed, 6 Oct 2004 09:03:41 -0700 (PDT) From: Bart Schaefer Reply-To: zsh-users@sunsite.dk To: ZSH User List cc: Andy Spiegl Subject: Re: howto correct 7etc to /etc ? In-Reply-To: <20041005235836.GA8546@spiegl.de> Message-ID: References: <20041005235836.GA8546@spiegl.de> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Spam-Checker-Version: SpamAssassin 2.63 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, hits=-0.0 required=6.0 tests=BAYES_44 autolearn=no version=2.63 X-Spam-Hits: -0.0 On Wed, 6 Oct 2004, Andy Spiegl wrote: > I'd like to configure my completion so that when I type > $ ls 7etc > > it corrects the mistyped 7 to (note: on German keyboards / is shift-7) > $ ls /etc > but only if the 7 is the first character of a path and if there isn't any > real file or directory that starts with a 7. Unfortunately "_correct" > doesn't do the job in this case. Something like this should do it: function _7slash { if [[ $words[CURRENT] = 7(#b)(*)(#e) ]] then compadd -U -X 'Correct leading 7 to /' -f /$match[1] fi } Then you add _7slash to your completer style after _correct, so that it's only tried if some other correction isn't found first. If you want _correct_word (bound to ^Xc) to use _7slash, you have to edit that function to append _7slash to the arguments of the _main_complete call. Arguably _correct_word should examine a style for the list of completers to use (possibly in addition to _correct rather than instead of it), but presently it does not.