From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19772 invoked from network); 29 Apr 2004 12:47:13 -0000 Received: from thor.dotsrc.org (HELO a.mx.sunsite.dk) (qmailr@130.225.247.86) by ns1.primenet.com.au with SMTP; 29 Apr 2004 12:47:13 -0000 Received: (qmail 13000 invoked from network); 29 Apr 2004 12:47:06 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 29 Apr 2004 12:47:06 -0000 Received: (qmail 15540 invoked by alias); 29 Apr 2004 12:47:04 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 19850 Received: (qmail 15529 invoked from network); 29 Apr 2004 12:47:03 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 29 Apr 2004 12:47:03 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [130.225.247.86] by sunsite.dk (MessageWall 1.0.8) with SMTP; 29 Apr 2004 12:47:3 -0000 Received: (qmail 12833 invoked from network); 29 Apr 2004 12:47:03 -0000 Received: from main.gmane.org (80.91.224.249) by a.mx.sunsite.dk with SMTP; 29 Apr 2004 12:47:01 -0000 Received: from list by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 1BJAwO-0002p8-00 for ; Thu, 29 Apr 2004 14:47:00 +0200 Received: from cpc3-oxfd4-4-0-cust194.oxfd.cable.ntl.com ([80.3.247.194]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 29 Apr 2004 14:46:59 +0200 Received: from david by cpc3-oxfd4-4-0-cust194.oxfd.cable.ntl.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 29 Apr 2004 14:46:59 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: zsh-workers@sunsite.dk From: zzapper Subject: Re: Completion of CLI parameters Date: Thu, 29 Apr 2004 13:46:55 +0100 Message-ID: References: <4me190pohevfcnoecm43f7ab9cclh3233g@4ax.com> <3763.1083238815@csr.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: cpc3-oxfd4-4-0-cust194.oxfd.cable.ntl.com X-Newsreader: Forte Free Agent 1.93/32.576 English (American) Sender: news Cc: zsh-users@sunsite.dk X-Spam-Checker-Version: SpamAssassin 2.63 on a.mx.sunsite.dk X-Spam-Level: * X-Spam-Status: No, hits=1.5 required=6.0 tests=BAYES_50,RCVD_IN_SORBS autolearn=no version=2.63 X-Spam-Hits: 1.5 On Thu, 29 Apr 2004 12:40:15 +0100, wrote: > >Here's a zle widget called insert-args-of which does the whole thing. >Type `cmd1' and execute the widget. Actually, !? searches for a string >inside the command, so it's more powerful than I suggested. What you >asked for works without the `?'s. > >Works without `banghist' in use, since turning that on locally seems to >be sufficient. > > >#start ># Zle widget to look at a string and replace it with the arguments ># of the last command in the history containing that string. > >emulate -L zsh >setopt banghist > ># Remember position >integer pos=$CURSOR > ># Find start of word. Just use whitespace. >while [[ $CURSOR -gt 1 && $LBUFFER[-1] != [[:space:]] ]]; do > (( CURSOR-- )) >done > ># Insert history substitution characters >LBUFFER+="!?" > ># Go back to start position, remembering extra characters. >(( CURSOR = pos + 2 )) > ># Search for end of word. >while [[ -n $RBUFFER && $RBUFFER[1] != [[:space:]] ]]; do > (( CURSOR++ )) >done > ># Insert trailing history substitution characters. >LBUFFER+="?:*" > ># Use magic-space to expand the history substitution. >zle magic-space >#end Sorry to abuse your helpfullness but could you give me a complete "idiots guide". I presumably need a zle bindkey function insert-args-of Do these all go in my startup files? (I use .zshenv) zzapper (vim, cygwin, wiki & zsh) -- vim -c ":%s/^/WhfgTNabgureRIvzSUnpxre/|:%s/[R-T]/ /Ig|:normal ggVGg?" http://www.vim.org/tips/tip.php?tip_id=305 Best of Vim Tips