:%sort
and :%!sort
do not necessarily work in the same way. To quote :help sort
:
The details about sorting depend on
the library function used. There is
no guarantee that sorting is "stable"
or obeys the current locale. You will
have to try it out.
On the other hand, GNU sort sorts according to the current locale. To quote man sort
:
* WARNING * The locale specified by the environment affects
sort order. Set LC_ALL=C to get the traditional sort order that uses
native byte values.
On my system (Ubuntu 9.10 with fr_CA.UTF-8 temporarily set) :%sort
sorts as if C
or POSIX
was set, while :%!sort
sorts according to the French locale.
My guess is that you've initially tried both :%sort
and :%!sort
under a POSIX-like locale (which yielded the same result), and then continued your experiments with different locales using :%sort
only (which always returned POSIX-like order). Can you confirm that?