diff options
-rw-r--r-- | runtime/doc/change.txt | 16 | ||||
-rw-r--r-- | runtime/doc/eval.txt | 24 |
2 files changed, 26 insertions, 14 deletions
diff --git a/runtime/doc/change.txt b/runtime/doc/change.txt index bdef544b2a..e353f3d209 100644 --- a/runtime/doc/change.txt +++ b/runtime/doc/change.txt @@ -1750,13 +1750,15 @@ found here: |sort()|, |uniq()|. With [i] case is ignored. - With [l] sort uses the current locale. See - `language collate` to check or set the locale used - for ordering. For example, with "en_US.UTF8", - Ö will be ordered after O and before P, - whereas with the Swedish locale "sv_SE.UTF8", - it will be after Z. - Case is typically ignored by the locale. + With [l] sort uses the current collation locale. + Implementation details: strcoll() is used to compare + strings. See |:language| to check or set the collation + locale. Example: > + :language collate en_US.UTF-8 + :%sort l +< |v:collate| can also used to check the current locale. + Sorting using the locale typically ignores case. + This does not work properly on Mac. Options [n][f][x][o][b] are mutually exclusive. diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 2aff9fc127..98f702af4c 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -8359,15 +8359,25 @@ sort({list} [, {func} [, {dict}]]) *sort()* *E702* When {func} is given and it is '1' or 'i' then case is ignored. - When {func} is given and it is 'l' then the current locale - is used for ordering. See `language collate` to check or set - the locale used for ordering. For example, with "en_US.UTF8", - Ö will be ordered after O and before P, whereas with the - Swedish locale "sv_SE.UTF8", it will be after Z. - Case is typically ignored by the locale. + When {func} is given and it is 'l' then the current collation + locale is used for ordering. Implementation details: strcoll() + is used to compare strings. See |:language| check or set the + collation locale. |v:collate| can also be used to check the + current locale. Sorting using the locale typically ignores + case. Example: > + " ö is sorted similarly to o with English locale. + :language collate en_US.UTF8 + :echo sort(['n', 'o', 'O', 'ö', 'p', 'z'], 'l') +< ['n', 'o', 'O', 'ö', 'p', 'z'] ~ +> + " ö is sorted after z with Swedish locale. + :language collate sv_SE.UTF8 + :echo sort(['n', 'o', 'O', 'ö', 'p', 'z'], 'l') +< ['n', 'o', 'O', 'p', 'z', 'ö'] ~ + This does not work properly on Mac. When {func} is given and it is 'n' then all items will be - sorted numerical (Implementation detail: This uses the + sorted numerical (Implementation detail: this uses the strtod() function to parse numbers, Strings, Lists, Dicts and Funcrefs will be considered as being 0). |