258

The current version of Notepad++ (at the time of this writing) is 6.6.3. Version 6.5.2 is the first that introduced a native (without a plugin) sorting function. At least, that's what they claim; even though we're nine releases after version 6.5.2, I have found nothing about this feature:

  • There is no sign of it in the menu (or I am blind),
  • There isn't even a word in Notepad++ documentation (online help).

Everything I read around the Internet (including this answer) still talks about sorting lines using the TextFX plugin. There isn't anything about a native (QuickSort-based) function.

So: How do I sort lines in Notepad++ without using the TextFX plugin?

392

The proper menu option is as follows.

For all versions prior to 6.8.3:

Menu EditLine OperationsSort Lines in Ascending / Descending Order

For version 6.8.3 and following:

Menu EditLine OperationsSort Lines Lexicographically Ascending / Descending

Select a few lines and your selection will be sorted. If there's no selection, your entire file will be sorted.

| improve this answer | |
  • 2
    Can't believe I've used Notepad++ for this long without knowing about this! – Jay Cummins Aug 3 '16 at 13:58
  • 4
    For some weird reason this didn't work for me. I'm on Windows but my text had LF line endings only (text pasted from browser). To work around it I had to convert all Line endings to Unix, then back to Windows, then the sort worked. – pgr Jan 26 '17 at 12:51
  • 1
    @trejder The fact that I had to convert one way and then back tells me the real problem is Notepad++'s realization of what kind of document it's working with. Maybe pasted text that hasn't been saved yet is an edge case. But it's definitely a bug, yes. – pgr Jan 28 '17 at 10:33
  • 3
    The next question could be whether it is possible to sort in a case-insensitive way... – Peter Mortensen Jul 20 '18 at 12:50
  • 1
    The sort function is not working correctly, it sorts like this: addCartLink bindPager setItemsTitle addTab – Black Oct 9 '18 at 14:10

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