* filename cycling according to age, not name
@ 2004-06-30 13:38 Kai Grossjohann
2004-06-30 13:44 ` Kai Grossjohann
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Kai Grossjohann @ 2004-06-30 13:38 UTC (permalink / raw)
To: zsh-users
Normally, I'm happy with the normal filename completion behavior of
zsh. (After I've customized it to my liking.) But from time to
time, I would like to say "give me the newest file under the foo
directory".
Is there a way to do this?
The ideal would be that I enter a partial filename (say "foo/") and
then hit a key, and it inserts the newest file in that directory
("foo/x"), and then I hit the key again and it replaces the filename
with the second-youngest ("foo/a"). Right now, the TAB key does
something similar, but it sorts by filename, not by age.
Right now, I have a function which does { ls -lt "$@" | head -15; }
and then I copy and paste, but I'm sure it can be done in a more
convenient manner.
Kai
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: filename cycling according to age, not name
2004-06-30 13:38 filename cycling according to age, not name Kai Grossjohann
@ 2004-06-30 13:44 ` Kai Grossjohann
[not found] ` <20040630135505.GA13539@laposte.net>
2004-06-30 16:05 ` Bart Schaefer
2 siblings, 0 replies; 4+ messages in thread
From: Kai Grossjohann @ 2004-06-30 13:44 UTC (permalink / raw)
To: zsh-users
Kai Grossjohann <kai@emptydomain.de> writes:
> Normally, I'm happy with the normal filename completion behavior of
> zsh. (After I've customized it to my liking.)
I forgot to include my zsh completion customization. This is zsh
4.2.0.
Kai
# The following lines were added by compinstall
zstyle ':completion:*' auto-description 'specify %d'
zstyle ':completion:*' completer _expand _complete _correct
zstyle ':completion:*' completions 1
zstyle ':completion:*' format 'Completing %d'
zstyle ':completion:*' glob 1
zstyle ':completion:*' list-colors ''
zstyle ':completion:*' list-prompt %SAt %p: Hit TAB for more, or the character to insert%s
zstyle ':completion:*' matcher-list '' 'm:{a-z}={A-Z}' 'r:|[._-/]=** r:|=**' 'l:|=* r:|=*'
zstyle ':completion:*' max-errors 3 numeric
zstyle ':completion:*' menu select=long
zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s
zstyle ':completion:*' substitute 1
zstyle ':completion:*' verbose true
zstyle :compinstall filename '/home/kgr/.zshrc'
autoload -U compinit
compinit
# End of lines added by compinstall
^ permalink raw reply [flat|nested] 4+ messages in thread
[parent not found: <20040630135505.GA13539@laposte.net>]
* Re: filename cycling according to age, not name
[not found] ` <20040630135505.GA13539@laposte.net>
@ 2004-06-30 14:13 ` Kai Grossjohann
0 siblings, 0 replies; 4+ messages in thread
From: Kai Grossjohann @ 2004-06-30 14:13 UTC (permalink / raw)
To: J; +Cc: Kai Grossjohann, zsh-users
J <jean.chalard@laposte.net> writes:
> - If you want this only occasionnally on a set of commands, you can't
> resort to the last method. You may use directly the globbing pattern
> I indicated, plus a range indicator : *(om[1]) is the last modified
> file in the directory, *(om[2]) the second last one, and *(om[1,2])
> the two first ones, most recent first. Then you can define a global
> alias for it, and/or bind a key to this in zle.
This sounds as if
less log.a/*(om[1])
would show me the newest file in that directory. That is not what
I'm looking for, but not too bad, either. Hm. Perhaps a function
"lessnew" expecting a directory and an optional number would do the
trick.
But if somebody knows the exact feature I was asking for, that would
be better.
Kai
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: filename cycling according to age, not name
2004-06-30 13:38 filename cycling according to age, not name Kai Grossjohann
2004-06-30 13:44 ` Kai Grossjohann
[not found] ` <20040630135505.GA13539@laposte.net>
@ 2004-06-30 16:05 ` Bart Schaefer
2 siblings, 0 replies; 4+ messages in thread
From: Bart Schaefer @ 2004-06-30 16:05 UTC (permalink / raw)
To: zsh-users
On Wed, 30 Jun 2004, Kai Grossjohann wrote:
> I would like [completion to] "give me the newest file under the foo
> directory".
>
> Is there a way to do this?
Get the _path_files completion function file out of the latest CVS version
of zsh so you have a working copy (it became broken in 4.2.0 because of an
unrelated change). Then set the file-sort zstyle.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2004-06-30 16:07 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-06-30 13:38 filename cycling according to age, not name Kai Grossjohann
2004-06-30 13:44 ` Kai Grossjohann
[not found] ` <20040630135505.GA13539@laposte.net>
2004-06-30 14:13 ` Kai Grossjohann
2004-06-30 16:05 ` Bart Schaefer
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).