From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29119 invoked from network); 23 Jun 2006 14:17:11 -0000 X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00, FORGED_RCVD_HELO autolearn=ham version=3.1.3 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 23 Jun 2006 14:17:11 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 58797 invoked from network); 23 Jun 2006 14:17:01 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 23 Jun 2006 14:17:01 -0000 Received: (qmail 11545 invoked by alias); 23 Jun 2006 14:16:54 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 10418 Received: (qmail 11535 invoked from network); 23 Jun 2006 14:16:53 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 23 Jun 2006 14:16:53 -0000 Received: (qmail 57775 invoked from network); 23 Jun 2006 14:16:53 -0000 Received: from ka.cs.utk.edu (160.36.56.221) by a.mx.sunsite.dk with SMTP; 23 Jun 2006 14:16:52 -0000 Received: from localhost (localhost [127.0.0.1]) by ka.cs.utk.edu (Postfix) with ESMTP id 134762F234 for ; Fri, 23 Jun 2006 10:17:15 -0400 (EDT) X-Virus-Scanned: by amavisd-new with ClamAV and SpamAssasin at cs.utk.edu Received: from ka.cs.utk.edu ([127.0.0.1]) by localhost (ka.cs.utk.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 37pBRL9Dzgrj for ; Fri, 23 Jun 2006 10:17:12 -0400 (EDT) Received: from namib.cs.utk.edu (namib.cs.utk.edu [160.36.59.92]) by ka.cs.utk.edu (Postfix) with ESMTP id 9F8372F21C for ; Fri, 23 Jun 2006 10:17:12 -0400 (EDT) Received: by namib.cs.utk.edu (Postfix, from userid 10605) id 374D136EFE; Fri, 23 Jun 2006 10:16:48 -0400 (EDT) Date: Fri, 23 Jun 2006 10:16:48 -0400 From: Chris Johnson To: zsh-users@sunsite.dk Subject: Source-File Favoring Completion Revised Message-ID: <20060623141648.GA11867@namib.cs.utk.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.9i I think I've finally got the completion I'm looking for to complete source code files before executable or binary files for text editors. Here's what I have: # I don't typically open these files with my text editor. zstyle ':completion:*:src-files' ignored-patterns \ '*?.o' '*?.pdf' '*?.aux' '*?.log' # This function filters out executable files who have a source code # namesake. File test will not be returned if test.c exists. src_files() { if [[ -e $REPLY.c ]]; then reply="" else reply=$REPLY fi } # Complete src_files before others. zstyle ':completion:*:*:(emacs|vi|vim):*' file-patterns \ '%p(e,src_files,):src-files' '*:all-files' This appears to work well for opening *.c and *.tex instead of the unreadable binary files that are generated from the source. Any input is appreciated! -- Chris Johnson cjohnson@cs.utk.edu http://www.cs.utk.edu/~cjohnson