I have the following text in a buffer:

² b
³ c
¹ a
⁴ d

The issue is that this is the text after running :sort (and :sort n ). My question is: why doesn't the superscripted numbers sort in the expected order, and how can I make them do so?


:%sort l failed for me as shown:

enter image description here

  • What does just :language show you? Before/after the :language collate en_US.UTF-8 command... Does it mention LC_ALL? If so, perhaps that's the problem... Also check the locale -a command in your shell, to see which locales are supported, is en_US.utf8 in the list at all? Maybe you don't have it installed? Are you on a Linux platform, if so, which distribution?
    – filbranden
    Dec 13, 2021 at 21:43

2 Answers 2


You can sort these symbols properly by using collation locale sort (modifier l):

:%sort l

For this to work, you need to have language collate setting set properly, for example:

:language collate en_US.UTF-8
  • 1
    I'm afraid I couldn't get this to work on a vim --clean (or indeed, any vim) - I've added a fuller response and screenshot to the question.
    – Joe
    Dec 13, 2021 at 21:06

Because the superscript numbers are not numbers. They are symbols. Let's assume you are using unicode, then the symbols are represented by the hexadecimal codes 0x00b2, 0x00b3, 0x00b9, 0x8304, 0x8308. And this also explains the sorted order - :sort will sort by the number representation of the symbols.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.