[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-bash] How to let completion sorted by time?
From: |
Chet Ramey |
Subject: |
Re: [Help-bash] How to let completion sorted by time? |
Date: |
Wed, 7 Feb 2018 08:19:16 -0500 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 |
On 2/6/18 11:24 PM, Peng Yu wrote:
> Hi,
>
> If I type TAB to complete a command with files in a directory, the
> files will be sorted by alphabetic order. Is there a way to print them
> ordered by their modification time when I type TAB? Thanks.
You can do it if you're using programmable completion. Use a shell
function, where you can sort the contents of $COMPREPLY any way you want,
and use `-o nosort' as one of the options when you install the compspec.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU address@hidden http://tiswww.cwru.edu/~chet/