From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27296 invoked from network); 7 Feb 2006 14:56:45 -0000 X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) 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.0 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 7 Feb 2006 14:56:45 -0000 Received: (qmail 37797 invoked from network); 7 Feb 2006 14:56:38 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 7 Feb 2006 14:56:38 -0000 Received: (qmail 20509 invoked by alias); 7 Feb 2006 14:56:28 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 9890 Received: (qmail 20496 invoked from network); 7 Feb 2006 14:56:28 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 7 Feb 2006 14:56:28 -0000 Received: (qmail 36720 invoked from network); 7 Feb 2006 14:56:28 -0000 Received: from cluster-c.mailcontrol.com (168.143.177.190) by a.mx.sunsite.dk with SMTP; 7 Feb 2006 14:56:26 -0000 Received: from exchange03.csr.com (uuk202166.uk.customer.alter.net [62.189.241.194] (may be forged)) by rly18c.srv.mailcontrol.com (MailControl) with ESMTP id k17EuOCF008180 for ; Tue, 7 Feb 2006 14:56:24 GMT Received: from csr.com ([10.103.143.38]) by exchange03.csr.com with Microsoft SMTPSVC(5.0.2195.6713); Tue, 7 Feb 2006 14:56:23 +0000 To: zsh-users@sunsite.dk (Zsh users list) Subject: Re: fastest way to bring up a shell function for editing? In-reply-to: <20060207144659.GB16047@dementia.beyondnormal.net> References: <20060207143637.GA22181@princo> <20060207144659.GB16047@dementia.beyondnormal.net> Date: Tue, 07 Feb 2006 14:56:11 +0000 From: Peter Stephenson Message-ID: X-OriginalArrivalTime: 07 Feb 2006 14:56:23.0559 (UTC) FILETIME=[A9B1D170:01C62BF6] Content-Type: text/plain MIME-Version: 1.0 X-Scanned-By: MailControl A-06-00-02 (www.mailcontrol.com) on 10.67.0.128 Mike Hernandez wrote: > Try this: > > % foo(){ echo "this is a function" } > % foo > this is a function > % vared foo() > function> echo "vared works... sort of" > % foo > vared works... sort of Err, actually what you're doing there is defining two functions, one called vared and one called foo, with the same body. The function> prompt is the usual continuation prompt. You'd get it just the same if the first line were: % foo() { Of course, in a case like this you can simply up-arrow and edit the foo()... a few lines before. Clint's answer is the most useful... the function zed supplied with the shell does this. Remember to autoload it. Pedantically, autoload -Uz zed zed -f foo Hit ^J when you're finished (or ^X^W if your terminal is weird). -- Peter Stephenson Software Engineer CSR PLC, Churchill House, Cambridge Business Park, Cowley Road Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070 To access the latest news from CSR copy this link into a web browser: http://www.csr.com/email_sig.php