exa currently sorts Capitalized items above non-capitalized items. For example:
$ exa -al
drwxrwx--- - jason 3 Aug 19:23 B
drwxrwx--- - jason 3 Aug 19:23 D
.rw-rw---- 0 jason 3 Aug 19:24 F
drwxrwx--- - jason 3 Aug 19:23 a
drwxrwx--- - jason 3 Aug 19:23 c
.rw-rw---- 0 jason 3 Aug 19:24 e
.rw-rw---- 0 jason 3 Aug 19:24 g
This is not the behavior I expect and doesn't match ls on my system.
Jason - in my mind this is the proper sort order... Capitals come before lower case. Just like all files starting with a period (".") come first too.
Maybe your *nix did not set LC_COLLATE to C but instead to a local language?
Some recent update in *nix changed this default behaviour, and now upper- and lowercase are grouped together, along with dotfiles. In my old-school mind, this does not compute.
I admit that I'm anything but old school when it comes to *nix platforms. LC_COLLATE doesn't appear to be set at all for me for what that's worth. I have been a regular Linux user for a few years now, and the degree to which this stands out to me suggests that I have never run into a system where files where ordered like this by ls.
In terms of ASCII/UTF-8 bytes capitals come before lowercase, but in terms of the (in my case) English language they don't. Sorting capitals first only makes sense if you aren't willing to expend a few extra CPU cycles sorting by letter instead of byte. That seems like the opposite of what this project is going for. Dotfiles at the top happens to make sense in both contexts, so I don't think it's relevant to this discussion.
Try LC_COLLATE=C ls -l - this is the default "C" language sort order.
I can understand the confusion if that's all you've ever seen (sort based on locale). For me it's the reverse (not seeing a C sort).
I guess exa should query the user's locale and output the sort based on that.
Yes, it always used to be that ls sorted in binary order (i.e. as if C was the locale), and it was handy to have README, TODO, etc come to the top of the listings. I preferred that and found lss switch to locale-sensitive sorting a bit of a pain. However I guess other people came in after ls changed.
I can't help but think of this XKCD. We can all at least agree that exa should support LC_COLLATE or some other way of choosing collation behavior, right?
Fascinating generational gap in this thread. I've been nixing for only about 5-ish years and have never even heard of sorting by capitals until now. It does appear that LC_COLLATE is not set by default on MacOS 10.13.4.
While setting it is no problem, it might be an issue that people must investigate to get resolved. If I'm understanding this correctly, setting the default sort to be locale-based would satisfy both cohorts since the ... um ... _more experienced_ users will have LC_COLLATE already set, resulting in an override of the default. This should leave both groups with zero additional configuration after install.
Great utility by the way. Thanks for all the work that has gone into it.
Is this still an issue? I was trying to reproduce this with exa 0.8, current master and ls with different settings of LC_COLLATE.
If so, could you give more info on the system and versions you are using and maybe the output of locale.
I just retested using exa 0.8.0 and 0.9.0-pre. I now get local sensitive sorting, regardless of LC_COLLATE value. The following is the output for 0.8.0. The output for 0.9.0 was identical (except the version string, obviously).
06:47禄@host ~/test$ /usr/bin/exa -v
exa v0.8.0
06:47禄@host ~/test$ locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
06:47禄@host ~/test$ /usr/bin/exa -l
.rw-rw---- 0 jason 14 Jul 6:39 a
.rw-rw---- 0 jason 14 Jul 6:39 B
.rw-rw---- 0 jason 14 Jul 6:39 c
.rw-rw---- 0 jason 14 Jul 6:39 D
.rw-rw---- 0 jason 14 Jul 6:39 e
drwxrwx--- - jason 14 Jul 6:42 exa
06:48禄@host ~/test$ LC_COLLATE=C /usr/bin/exa -l
.rw-rw---- 0 jason 14 Jul 6:39 a
.rw-rw---- 0 jason 14 Jul 6:39 B
.rw-rw---- 0 jason 14 Jul 6:39 c
.rw-rw---- 0 jason 14 Jul 6:39 D
.rw-rw---- 0 jason 14 Jul 6:39 e
drwxrwx--- - jason 14 Jul 6:42 exa
@jason-watkins do you think your specific issue is fixed (and we should close this issue)?
There are other issues opened regarding sorting and locale, most notably #410.
Yes, per my previous comment it does seem to be fixed.
Most helpful comment
I can't help but think of this XKCD. We can all at least agree that
exashould support LC_COLLATE or some other way of choosing collation behavior, right?