From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 787 invoked from network); 23 Dec 2003 01:05:53 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 23 Dec 2003 01:05:53 -0000 Received: (qmail 26565 invoked by alias); 23 Dec 2003 01:05:36 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 6957 Received: (qmail 26469 invoked from network); 23 Dec 2003 01:05:36 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 23 Dec 2003 01:05:36 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [80.184.44.252] by sunsite.dk (MessageWall 1.0.8) with SMTP; 23 Dec 2003 1:5:35 -0000 Received: from opk by athlon with esmtp (masqmail 0.2.20) id 1AYb2K-0IO-00; Tue, 23 Dec 2003 02:08:36 +0100 cc: Zsh Users In-reply-to: <20031222235658.GA18521@fruitcom.com> From: Oliver Kiddle References: <20031222235658.GA18521@fruitcom.com> To: Eric Smith Subject: Re: function to return most recently modified file to command line Date: Tue, 23 Dec 2003 02:08:36 +0100 Message-ID: <1139.1072141716@athlon> Eric Smith wrote: > I would like to have a function ideally to bind to a key combination > that returns the most recent file to the command line. > > Like I might type > $ acroread I do this with a completion widget: zstyle ':completion:most-recent-file:*' match-original both zstyle ':completion:most-recent-file::::' completer _menu _files _match zstyle ':completion:most-recent-file:*' file-sort modification zstyle ':completion:most-recent-file:*' file-patterns '*(.):normal\ files' zstyle ':completion:most-recent-file:*' hidden all bindkey '^Xm' most-recent-file zle -C most-recent-file menu-complete _generic > Specify the type of file say `pdf' or `txt' for the latest instance > of that type of file. The _match bit allows that: type *.pdf and ^Xm will get you the most recent .pdf file. > Also the function could automatically add an after returning the > filename. You can probably use a normal zle widget which invokes this followed by accept-line. You'd lose the feature that invoking this multiple times cycles through files in modification order though. I'm now away for a couple of weeks, by the way. Have a good Christmas everyone. Oliver