From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14290 invoked from network); 20 May 2005 14:50:05 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 20 May 2005 14:50:05 -0000 Received: (qmail 99188 invoked from network); 20 May 2005 14:49:58 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 20 May 2005 14:49:58 -0000 Received: (qmail 11681 invoked by alias); 20 May 2005 14:49:52 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 8878 Received: (qmail 11672 invoked from network); 20 May 2005 14:49:52 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 20 May 2005 14:49:52 -0000 Received: (qmail 98267 invoked from network); 20 May 2005 14:49:51 -0000 Received: from vms040pub.verizon.net (206.46.252.40) by a.mx.sunsite.dk with SMTP; 20 May 2005 14:49:45 -0000 Received: from candle.brasslantern.com ([4.11.1.68]) by vms040.mailsrvcs.net (Sun Java System Messaging Server 6.2 HotFix 0.04 (built Dec 24 2004)) with ESMTPA id <0IGS000MQMIV8KK2@vms040.mailsrvcs.net> for zsh-users@sunsite.dk; Fri, 20 May 2005 09:49:44 -0500 (CDT) 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 j4KEngjn007193 for ; Fri, 20 May 2005 07:49:42 -0700 Received: (from schaefer@localhost) by candle.brasslantern.com (8.12.11/8.12.11/Submit) id j4KEng9Y007192 for zsh-users@sunsite.dk; Fri, 20 May 2005 07:49:42 -0700 Date: Fri, 20 May 2005 14:49:42 +0000 From: Bart Schaefer Subject: Re: retrieving the results of last command? In-reply-to: <20050520121834.GA32499@let.rug.nl> To: Zsh User Message-id: <1050520144942.ZM7191@candle.brasslantern.com> MIME-version: 1.0 X-Mailer: Z-Mail (5.0.0 30July97) Content-type: text/plain; charset=us-ascii References: <20050520121834.GA32499@let.rug.nl> Comments: In reply to Francisco Borges "retrieving the results of last command?" (May 20, 2:18pm) 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=AWL,BAYES_00 autolearn=ham version=3.0.2 X-Spam-Hits: -2.6 On May 20, 2:18pm, Francisco Borges wrote: } } Often I'm in the situation of using say: } } % locate a-file } /usr/share/prog/a-file } % } } Then I want to use the pathname to copy the file. The least computationally expensive way to do this is to save the output in the first place. E.g., Functions/Zle/keeper in the current dev versions of zsh, available from the SourceForge CVS server. You might even want to add locate() { command locate "$@" | keep } Another trick that I do is # Imaginative function naming here, I know esc-backquote() { BUFFER='$( '"$BUFFER"' )'; CURSOR=0 } zle -N esc-backquote bindkey '\e`' esc-backquote Then I can search through the history any way I like and when I find the command whose output I want to capture, type ESC-` to wrap it in $( ... ). I also have bindkey -s '\ev' '\e`vi ' so that ESC-v leaves me with "vi $( ... )" but I don't use that one much any more, for some reason.