From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24033 invoked from network); 15 Jul 2006 16:05:28 -0000 X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_00, FORGED_RCVD_HELO autolearn=ham version=3.1.3 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 15 Jul 2006 16:05:28 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 86962 invoked from network); 15 Jul 2006 16:05:21 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 15 Jul 2006 16:05:21 -0000 Received: (qmail 5016 invoked by alias); 15 Jul 2006 16:05:09 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 10517 Received: (qmail 5006 invoked from network); 15 Jul 2006 16:05:08 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 15 Jul 2006 16:05:08 -0000 Received: (qmail 85098 invoked from network); 15 Jul 2006 16:05:08 -0000 Received: from ug-out-1314.google.com (66.249.92.171) by a.mx.sunsite.dk with SMTP; 15 Jul 2006 16:05:05 -0000 Received: by ug-out-1314.google.com with SMTP id c2so1190068ugf for ; Sat, 15 Jul 2006 09:05:05 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=pE9YTBJeM2XVqY2jZo4CS2zqLyPHBwwlCaY0Nx95mK+Qv+6cI7qF1NMC/AFxJOIQ9E2Uc+RJZM1uIaQyFadl7U1ZUWUwmkfp4Cri8t4ZUEhsKn4SeYi2FECb8SMm37zcCew5V1iwkKw0aK4aPdiYMM12nXgwHXgBZVSk2yHL/fU= Received: by 10.67.93.7 with SMTP id v7mr815459ugl; Sat, 15 Jul 2006 09:05:04 -0700 (PDT) Received: by 10.66.222.13 with HTTP; Sat, 15 Jul 2006 09:05:04 -0700 (PDT) Message-ID: <237967ef0607150905v400bac6cl9dc9add48786074a@mail.gmail.com> Date: Sat, 15 Jul 2006 18:05:04 +0200 From: "Mikael Magnusson" To: zsh-users@sunsite.dk Subject: Re: Using Global aliases to make a "macro" shell Cc: zzapper In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: On 7/15/06, zzapper wrote: > Using Global aliases to make a "macro" shell > > It took me a while to suss these > > example: > > cp NF ND > Where NF means Newest File in directory and > ND is newsest directory > > NF and ND are actually Global Aliases > > alias -g ND='$(ls -d *(/om[1]))' # newset directory > alias -g NF='$(ls *(.om[1]))' # newest file > > Using these "primitives" ie NF,ND and others has saved me writing lots of > repetive shell scripts. A related very useful keybind is bindkey "^N" _most_recent_file although it completes files and directories alike, despite the name. Also very useful is bindkey "^[^N" _most_accessed_file Just copy _most_recent_file and apply 17c17 < eval "file=($PREFIX*$SUFFIX(om[${NUMERIC:-1}]N))" --- > eval "file=($PREFIX*$SUFFIX(oa[${NUMERIC:-1}]N))" 21c21 < eval "file=($PREFIX*$SUFFIX(om[${NUMERIC:-1}]N))" --- > eval "file=($PREFIX*$SUFFIX(oa[${NUMERIC:-1}]N))" PS why the ls invocations? this seems to work just as well alias -g NF='*(.om[1])' alias -g ND='*(/om[1])' -- Mikael Magnusson