From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12617 invoked by alias); 10 Jan 2015 20:11:16 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 19724 Received: (qmail 12085 invoked from network); 10 Jan 2015 20:11:04 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 X-Originating-IP: [86.6.153.127] X-Spam: 0 X-Authority: v=2.1 cv=AoZg3YNP c=1 sm=1 tr=0 a=39NrsSuza2clQiZR/7fYWQ==:117 a=39NrsSuza2clQiZR/7fYWQ==:17 a=kj9zAlcOel0A:10 a=NLZqzBF-AAAA:8 a=pGLkceISAAAA:8 a=Efalt1ohfJgGBnNKGp0A:9 a=CjuIK1q_8ugA:10 Date: Sat, 10 Jan 2015 20:11:00 +0000 From: Peter Stephenson To: kamaraju kusumanchi , zsh-users@zsh.org Subject: Re: tab completion sort by modification time Message-ID: <20150110201100.61b16d41@ntlworld.com> In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Sat, 10 Jan 2015 14:33:49 -0500 kamaraju kusumanchi 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