* Modify sort ordering for `ls`
@ 2017-08-18 20:32 Daniel Li
2017-08-18 20:34 ` Daniel Li
2017-08-18 20:44 ` Phil Pennock
0 siblings, 2 replies; 4+ messages in thread
From: Daniel Li @ 2017-08-18 20:32 UTC (permalink / raw)
To: zsh-workers
[-- Attachment #1: Type: text/plain, Size: 1070 bytes --]
Hi all,
I noticed on Mac, ls -l sorts a dot (.) before alphanumerics, which I
consider to be correct for purposes of tab completion:
-rw-r--r-- 1 dan dan 0B Aug 18 13:20 VeryLongFileName.scala
-rw-r--r-- 1 dan dan 0B Aug 18 13:20 VeryLongFileNameHelper.scala
Whereas on Ubuntu, ls -l gives the reverse:
-rw-rw-r-- 1 ubuntu ubuntu 0 Aug 18 13:22 VeryLongFileNameHelper.scala
-rw-rw-r-- 1 ubuntu ubuntu 0 Aug 18 13:22 VeryLongFileName.scala
On the flip side, Zsh on Mac sorts a dot after a dash (-), which for
purposes of tab completion feels unnatural:
-rw-r--r-- 1 dan dan 0B Aug 18 13:22 data-extra.bin
-rw-r--r-- 1 dan dan 0B Aug 18 13:22 data.bin
On Ubuntu, this behavior is again reversed:
-rw-rw-r-- 1 ubuntu ubuntu 0 Aug 18 13:22 data.bin
-rw-rw-r-- 1 ubuntu ubuntu 0 Aug 18 13:22 data-extra.bin
Is it possible to manually specify (say, in .zshrc or an LS_* env var) the
sort ordering? If not, can this feature be added?
Regards,
Daniel Li
*Daniel Li*
Senior Backend Engineer at Tubi TV
560 Mission St, Suite 1301
San Francisco, CA 94105
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Modify sort ordering for `ls`
2017-08-18 20:32 Modify sort ordering for `ls` Daniel Li
@ 2017-08-18 20:34 ` Daniel Li
2017-08-18 20:44 ` Phil Pennock
1 sibling, 0 replies; 4+ messages in thread
From: Daniel Li @ 2017-08-18 20:34 UTC (permalink / raw)
To: zsh-workers
[-- Attachment #1: Type: text/plain, Size: 165 bytes --]
To clarify, this inconsistent sort ordering manifests both when using ls as
well as when doing tab completion. It probably shows up in other places in
Zsh as well.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Modify sort ordering for `ls`
2017-08-18 20:32 Modify sort ordering for `ls` Daniel Li
2017-08-18 20:34 ` Daniel Li
@ 2017-08-18 20:44 ` Phil Pennock
2017-08-18 22:24 ` Daniel Li
1 sibling, 1 reply; 4+ messages in thread
From: Phil Pennock @ 2017-08-18 20:44 UTC (permalink / raw)
To: Daniel Li; +Cc: zsh-workers
On 2017-08-18 at 13:32 -0700, Daniel Li wrote:
> Whereas on Ubuntu, ls -l gives the reverse:
>
> -rw-rw-r-- 1 ubuntu ubuntu 0 Aug 18 13:22 VeryLongFileNameHelper.scala
> -rw-rw-r-- 1 ubuntu ubuntu 0 Aug 18 13:22 VeryLongFileName.scala
export LC_COLLATE=POSIX
1. The default sort ordering is driven by locale.
2. Zsh can do things about results of stuff driven by zsh, including
glob expansion.
3. The above is not using zsh glob expansion.
4. How ls(1) works should be documented in its man-page and other than
via the environment, Zsh can't do anything here. There's no
environment variables _we_ can add to _your_ system ls.
Ultimately, if you can't find a locale collation which works for your
purposes, you can dive deep and write your own collation specification.
If your OS allows use of private locale definitions, then these should
work in _all_ locale-aware applications, not just ls(1).
http://pubs.opengroup.org/onlinepubs/009696699/utilities/localedef.html
http://pubs.opengroup.org/onlinepubs/009696699/basedefs/xbd_chap07.html
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Modify sort ordering for `ls`
2017-08-18 20:44 ` Phil Pennock
@ 2017-08-18 22:24 ` Daniel Li
0 siblings, 0 replies; 4+ messages in thread
From: Daniel Li @ 2017-08-18 22:24 UTC (permalink / raw)
To: Phil Pennock; +Cc: zsh-workers
[-- Attachment #1: Type: text/plain, Size: 1351 bytes --]
That's just what I'm looking for. Thanks!
Daniel Li
*Daniel Li*
Senior Backend Engineer at Tubi TV
560 Mission St, Suite 1301
San Francisco, CA 94105
On Fri, Aug 18, 2017 at 1:44 PM, Phil Pennock <
zsh-workers+phil.pennock@spodhuis.org> wrote:
> On 2017-08-18 at 13:32 -0700, Daniel Li wrote:
> > Whereas on Ubuntu, ls -l gives the reverse:
> >
> > -rw-rw-r-- 1 ubuntu ubuntu 0 Aug 18 13:22 VeryLongFileNameHelper.scala
> > -rw-rw-r-- 1 ubuntu ubuntu 0 Aug 18 13:22 VeryLongFileName.scala
>
> export LC_COLLATE=POSIX
>
> 1. The default sort ordering is driven by locale.
> 2. Zsh can do things about results of stuff driven by zsh, including
> glob expansion.
> 3. The above is not using zsh glob expansion.
> 4. How ls(1) works should be documented in its man-page and other than
> via the environment, Zsh can't do anything here. There's no
> environment variables _we_ can add to _your_ system ls.
>
> Ultimately, if you can't find a locale collation which works for your
> purposes, you can dive deep and write your own collation specification.
> If your OS allows use of private locale definitions, then these should
> work in _all_ locale-aware applications, not just ls(1).
>
> http://pubs.opengroup.org/onlinepubs/009696699/utilities/localedef.html
> http://pubs.opengroup.org/onlinepubs/009696699/basedefs/xbd_chap07.html
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-08-18 22:24 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-18 20:32 Modify sort ordering for `ls` Daniel Li
2017-08-18 20:34 ` Daniel Li
2017-08-18 20:44 ` Phil Pennock
2017-08-18 22:24 ` Daniel Li
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).