Discussion:
[Help-bash] How to let completion sorted by time?
Peng Yu
2018-02-07 04:24:50 UTC
Permalink
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.
--
Regards,
Peng
Chet Ramey
2018-02-07 13:19:16 UTC
Permalink
Post by Peng Yu
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 ***@case.edu http://tiswww.cwru.edu/~chet/
Loading...