k
k copied to clipboard
sort by date
Would be real nice to port the equivalent of the -t flag in ls to sort by date (most recent last).
Very useful for messy home dirs like mine :sweat_smile:
Also suggest sorting by file size
There's an implementation of sort by time (-s m/--sort m) and size (-s L/--sort L), including -r/--reverse direction, available at reduxionist/k/tree/feature/sort-options .
@jaromil @k2xl , if you guys could please give it a try and let me know what you think, then once it's looking good to us we can ask @supercrabtree whether he wants to add it, and then, if so, what needs to be done before issuing the PR...
Thanks for k @supercrabtree!
Works great on my setup. For the record, to quickly install your branch with antigen:
antigen bundle reduxionist/k --branch=feature/sort-options
Hello,
I have been neglecting k for a little too long. This feature sounds great, if you would like to submit a PR I would happily review and merge.
Thanks
Cool, in that case: using zsh's sort globs as the options was the cleanest approach I saw. Substituting directly made the only change to existing lines a $SORT_GLOB appendix on the glob qualifiers. I subsequently noticed the design specification in #27, however, which suggests implementing the rest of ls's arg spec as is. The backwards-compatibility is one of the main reasons k keeps winning "ls alternative of choice" for me; I've invested too much muscle memory at the console to reprogram the synapses for those options now. Objectively, the average user is unlikely to be as fluent in glob qualifiers as they are with ls arguments, so I think it's worth adding a mapping step to go from ls sort arg input to zsh glob spec commands. Unless you say otherwise, I'll submit a PR for that first and just leave the current branch hanging for now in case you prefer the simpler implementation. In any case, should I rebase on the currently active branches or stick to master?
Hi, sounds good, please use master as a base branch :)