* function to return most recently modified file to command line
@ 2003-12-22 23:56 Eric Smith
2003-12-23 1:08 ` Oliver Kiddle
0 siblings, 1 reply; 4+ messages in thread
From: Eric Smith @ 2003-12-22 23:56 UTC (permalink / raw)
To: Zsh Users
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 <Alt-B>
would give
$ acroread todays_news.pdf
A couple of nice extra features would be:
Specify the type of file say `pdf' or `txt' for the latest instance
of that type of file.
Also the function could automatically add an <enter> after returning the
filename.
thanx!
--
Eric Smith
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: function to return most recently modified file to command line
2003-12-22 23:56 function to return most recently modified file to command line Eric Smith
@ 2003-12-23 1:08 ` Oliver Kiddle
2004-01-11 16:15 ` function to return most recently modified file to command line - cycling in both directions Eric Smith - Fruitcom
0 siblings, 1 reply; 4+ messages in thread
From: Oliver Kiddle @ 2003-12-23 1:08 UTC (permalink / raw)
To: Eric Smith; +Cc: Zsh Users
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 <Alt-B>
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 <enter> 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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: function to return most recently modified file to command line - cycling in both directions
2003-12-23 1:08 ` Oliver Kiddle
@ 2004-01-11 16:15 ` Eric Smith - Fruitcom
2004-01-14 16:07 ` Oliver Kiddle
0 siblings, 1 reply; 4+ messages in thread
From: Eric Smith - Fruitcom @ 2004-01-11 16:15 UTC (permalink / raw)
To: Zsh Users
Hi Oliver
This approach of yours has radically improved my environment. Thank you.
BTW, the _match bit did not work until I moved that token in front
of completer (for some reason).
I would like to know if you have (or can perhaps think of)
a way to cycle backwards through the file list - say if you miss the file
that you want. Like you would with <c-r> and <c-o> in back-i-search.
ciao
According to Oliver Kiddle on Tue, Dec 23, 2003 at 02:08:36AM +0100:
> 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 <Alt-B>
>
> 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 <enter> 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
--
Eric Smith
Fruitcom BV
Tel: +31 15 219 0468
Fax: +31 15 219 0524
Mobile: +31 6 551 76300
www.fruitcom.com
PO Box 2855
2601 CW Delft
The Netherlands
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2004-01-14 16:04 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-12-22 23:56 function to return most recently modified file to command line Eric Smith
2003-12-23 1:08 ` Oliver Kiddle
2004-01-11 16:15 ` function to return most recently modified file to command line - cycling in both directions Eric Smith - Fruitcom
2004-01-14 16:07 ` Oliver Kiddle
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).