Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: function to return most recently modified file to command line
- X-seq: zsh-users 6957
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: Eric Smith <es@xxxxxxxxxxxx>
- Subject: Re: function to return most recently modified file to command line
- Date: Tue, 23 Dec 2003 02:08:36 +0100
- Cc: Zsh Users <zsh-users@xxxxxxxxxx>
- In-reply-to: <20031222235658.GA18521@xxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20031222235658.GA18521@xxxxxxxxxxxx>
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author