From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1091 invoked from network); 30 Apr 2004 05:10:31 -0000 Received: from thor.dotsrc.org (HELO a.mx.sunsite.dk) (qmailr@130.225.247.86) by ns1.primenet.com.au with SMTP; 30 Apr 2004 05:10:31 -0000 Received: (qmail 30177 invoked from network); 30 Apr 2004 05:09:53 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 30 Apr 2004 05:09:53 -0000 Received: (qmail 29493 invoked by alias); 30 Apr 2004 05:09:44 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 7421 Received: (qmail 29450 invoked from network); 30 Apr 2004 05:09:44 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 30 Apr 2004 05:09:44 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [130.225.247.86] by sunsite.dk (MessageWall 1.0.8) with SMTP; 30 Apr 2004 5:9:43 -0000 Received: (qmail 29605 invoked by uid 1002); 30 Apr 2004 05:09:43 -0000 Received: from wbar3.sjo1-4-11-009-147.sjo1.dsl-verizon.net (HELO candle.brasslantern.com) (4.11.9.147) by a.mx.sunsite.dk with SMTP; 29 Apr 2004 15:00:00 -0000 Received: (from schaefer@localhost) by candle.brasslantern.com (8.11.6/8.11.6) id i3TExxV31111 for zsh-users@sunsite.dk; Thu, 29 Apr 2004 07:59:59 -0700 X-Authentication-Warning: candle.brasslantern.com: schaefer set sender to schaefer@closedmail.com using -f From: Bart Schaefer Message-Id: <1040429145959.ZM31110@candle.brasslantern.com> Date: Thu, 29 Apr 2004 14:59:58 +0000 In-Reply-To: <15385.1083243379@csr.com> Comments: In reply to Peter Stephenson "Re: Completion of CLI parameters" (Apr 29, 1:56pm) References: <15385.1083243379@csr.com> X-Mailer: Z-Mail (5.0.0 30July97) To: zsh-users@sunsite.dk Subject: Re: Completion of CLI parameters 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-Status: Yes, hits=7.7 required=6.0 tests=RCVD_IN_DYNABLOCK, RCVD_IN_NJABL,RCVD_IN_NJABL_DIALUP,RCVD_IN_SORBS autolearn=no version=2.63 X-Spam-Hits: 7.7 On Apr 29, 1:56pm, Peter Stephenson wrote: } } autoload -U insert-args-of } zle -N insert-args-of } bindkey '^x^a' insert-args-of Oliver would say this was crying out to be a _generic completer; here's a trivial stab at one. However, the right thing would be for _expand to recognize a zstyle -- perhaps named "expander" -- that would supply a function to produce expansions, and to try calling that before falling back on the usual shell expansions. That way we'd get the full power of all the other styles recognized by _expand. The following suffers from the usual problems of menus that may contain multi-line structures, I haven't done anything to address that. #autoload # Name this file expand-args-of and place it in a $fpath directory, and # then add these commands to .zshrc: # zle -C expand-args-of complete-word _generic # zstyle ':completion:expand-args-of::::' completer expand-args-of # bindkey '^x^a' expand-args-of local pat=$words[CURRENT] local -a exp if ((CURRENT > 1)) then # Remove the first * here to match on command name only exp=( $history[(R)*${(q)pat}*] ) exp=( ${exp#*[[:space:]]} ) else exp=( $history[(R)${(q)pat}*] ) fi compadd -UQ -a exp compstate[insert]=menu #end of expand-args-of -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net