From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24911 invoked from network); 11 Mar 2005 16:50:58 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 11 Mar 2005 16:50:58 -0000 Received: (qmail 53997 invoked from network); 11 Mar 2005 16:50:49 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 11 Mar 2005 16:50:49 -0000 Received: (qmail 7543 invoked by alias); 11 Mar 2005 16:50:42 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 8583 Received: (qmail 7533 invoked from network); 11 Mar 2005 16:50:42 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 11 Mar 2005 16:50:42 -0000 Received: (qmail 53126 invoked from network); 11 Mar 2005 16:50:42 -0000 Received: from vms048pub.verizon.net (206.46.252.48) by a.mx.sunsite.dk with SMTP; 11 Mar 2005 16:50:31 -0000 Received: from candle.brasslantern.com ([4.11.1.68]) by vms048.mailsrvcs.net (Sun Java System Messaging Server 6.2 HotFix 0.04 (built Dec 24 2004)) with ESMTPA id <0ID70021R5G5X1S0@vms048.mailsrvcs.net> for zsh-users@sunsite.dk; Fri, 11 Mar 2005 10:50:30 -0600 (CST) Received: from candle.brasslantern.com (IDENT:schaefer@localhost [127.0.0.1]) by candle.brasslantern.com (8.12.11/8.12.11) with ESMTP id j2BGoRwn010690 for ; Fri, 11 Mar 2005 08:50:28 -0800 Received: (from schaefer@localhost) by candle.brasslantern.com (8.12.11/8.12.11/Submit) id j2BGoR3C010689 for zsh-users@sunsite.dk; Fri, 11 Mar 2005 08:50:27 -0800 Date: Fri, 11 Mar 2005 16:50:27 +0000 From: Bart Schaefer Subject: Re: Text Editor Filename Completion In-reply-to: <200503111310.j2BDA7v8013309@news01.csr.com> To: zsh-users@sunsite.dk Message-id: <1050311165027.ZM10688@candle.brasslantern.com> MIME-version: 1.0 X-Mailer: Z-Mail (5.0.0 30July97) Content-type: text/plain; charset=us-ascii References: <20050311125532.GA22235@namib.cs.utk.edu> <200503111310.j2BDA7v8013309@news01.csr.com> Comments: In reply to Peter Stephenson "Re: Text Editor Filename Completion" (Mar 11, 1:10pm) X-Spam-Checker-Version: SpamAssassin 3.0.2 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, score=-2.6 required=6.0 tests=BAYES_00 autolearn=ham version=3.0.2 X-Spam-Hits: -2.6 On Mar 11, 1:10pm, Peter Stephenson wrote: } Subject: Re: Text Editor Filename Completion } } > Does anyone have any completion commands set up for vi or emacs that } > give preference to plain text files -- those containing source code -- } } zstyle ':completion:*:*:(emacs|vi):*' file-patterns \ } '*.(c|h|pl|tex|txt):globbed-files *(-/):directories' '*:all-files' How about this: textfiles() { reply=( ${${(@M)${(f)"$(file $REPLY 2>/dev/null)"}\:#*text*}%:*} ) } zstyle ':completion:*:*:(emacs|vi|vim):*' file-patterns \ '%p(e,textfiles,):globbed-files *(-/):directories' '*:all-files' (I found that I needed the "|vim" in there because vi is aliased to vim on my system and the alias is expanded before the completion context is established [unless you setopt completealiases]).