From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6287 invoked from network); 19 Jan 2006 19:37:59 -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; 19 Jan 2006 19:37:59 -0000 Received: (qmail 48491 invoked from network); 19 Jan 2006 19:37:46 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 19 Jan 2006 19:37:46 -0000 Received: (qmail 17137 invoked by alias); 19 Jan 2006 19:37:38 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 9840 Received: (qmail 17127 invoked from network); 19 Jan 2006 19:37:37 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 19 Jan 2006 19:37:37 -0000 Received: (qmail 47440 invoked from network); 19 Jan 2006 19:37:37 -0000 Received: from bes.cs.utk.edu (160.36.56.220) by a.mx.sunsite.dk with SMTP; 19 Jan 2006 19:37:35 -0000 Received: from localhost (bes [127.0.0.1]) by bes.cs.utk.edu (Postfix) with ESMTP id 1FBE7273E5 for ; Thu, 19 Jan 2006 14:37:24 -0500 (EST) Received: from bes.cs.utk.edu ([127.0.0.1]) by localhost (bes [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 26362-10 for ; Thu, 19 Jan 2006 14:37:22 -0500 (EST) Received: from namib.cs.utk.edu (namib.cs.utk.edu [160.36.59.92]) by bes.cs.utk.edu (Postfix) with ESMTP id 04684273E4 for ; Thu, 19 Jan 2006 14:37:22 -0500 (EST) Received: by namib.cs.utk.edu (Postfix, from userid 10605) id BFE6636EE4; Thu, 19 Jan 2006 14:37:21 -0500 (EST) Date: Thu, 19 Jan 2006 14:37:21 -0500 From: Chris Johnson To: zsh-users@sunsite.dk Subject: Command Utility Belt Message-ID: <20060119193721.GA8560@namib.cs.utk.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.9i X-Virus-Scanned: by amavisd-new with ClamAV and SpamAssasin at cs.utk.edu I'm finding that I have a lot of semi-often used commands that aren't exactly appropriate for aliasing -- they need minor editing each time I call on them. Furthermore, they're cryptic enough that it would be nice to able to recall these commands easily (for editing). I wonder if anyone knows a good solution. Two ideas I've had work okay. The first is to assign the command to an alias that does 'print -z' on the command. For example: alias my_command='print -z prog arg1 arg2 arg3 ...' The drawback to this is that it introduces a superfluous accept-line. The second is to assign the plain old command to an alias and bind a key to _expand_alias. This will of course expand the alias and keep the line active for editing. The drawback to this one is that I have to have the cursor on the alias itself to expand it. I've fashioned a widget to allow arbitrary alias expansion: expand-alias() { zle beginning-of-line zle vi-forward-char zle _expand_alias } zle -N expand-alias A third solution, which I might prefer but haven't yet attempted, is to prime the history with these commands. I think 'print -s' would do this. Has anyone else implemented such a "command utility belt" and have recommendations? Thanks! -- Chris Johnson cjohnson@cs.utk.edu http://www.cs.utk.edu/~cjohnson