zsh-users
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.w.stephenson@ntlworld.com>
To: kamaraju kusumanchi <raju.mailinglists@gmail.com>, zsh-users@zsh.org
Subject: Re: tab completion sort by modification time
Date: Sat, 10 Jan 2015 20:11:00 +0000	[thread overview]
Message-ID: <20150110201100.61b16d41@ntlworld.com> (raw)
In-Reply-To: <CABpbYafixR-PGF9TpOpUzpAWNFauL2b6Kagq7Ub=Pxir5Rt9aw@mail.gmail.com>

On Sat, 10 Jan 2015 14:33:49 -0500
kamaraju kusumanchi <raju.mailinglists@gmail.com> wrote:
> Long time bash user here. Looking to see if zsh can solve my
> particular problem. If it does, I'd like to switch to it.
> 
> Say  a directory contains a lot of files and say I am only interested
> in the files that were recently edited/created. When doing a tab
> completion inside this directory, I would like the files to be listed
> in the order of modification time (similar to ls -rt). This way the
> latest files show up at the end and I can easily copy/paste their
> names using mouse onto the command line.
>
> Is zsh tab completion system comprehensive enough to do something like this?

I'm assuming as a bash user you're not subscribed to zsh-users...

If you want this behaviour globally, I think it's as simple as the
following piece of configuration:

zstyle ':completion:*' file-sort modification

If you want more control, reading the zshcompsys manual page should give
you ideas of how to modify that first argument --- which is a pattern
matching the context in which a completion occurs --- should give you
some ideas how to do so.

It's also relatively straightforward (i.e someone here can work out
how to do it in a few minutes after you've scratched your head for
half an hour:-)) to add a new key binding that has this file completion
behaviour.

pws


  parent reply	other threads:[~2015-01-10 20:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-10 19:33 kamaraju kusumanchi
2015-01-10 19:52 ` Eric Cook
2015-01-11  4:40   ` kamaraju kusumanchi
2015-01-12  5:58     ` kamaraju kusumanchi
2015-01-10 20:11 ` Peter Stephenson [this message]
2015-01-10 20:30   ` Mikael Magnusson
2015-01-10 22:08     ` kamaraju kusumanchi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150110201100.61b16d41@ntlworld.com \
    --to=p.w.stephenson@ntlworld.com \
    --cc=raju.mailinglists@gmail.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).