vrapper/vrapper — pull request #136 by bdetweiler (2012-12-21 03:34:41+00:00)
Title: Initial :sor/:sort support

Sorry for the radio silence. I was on vacation for a week away from computers and internet and such.

Here is my initial implementation of :sort which should be good enough to be usable in most cases.

Goal:
*:sor* *:sort*
:[range]sor[t][!] [i][u][r][n][b][x][o] [/{pattern}/]

This currently supports the following:

* With [!] the order is reversed.
* With [i] case is ignored.
* With [n] sorting is done on the first decimal number in the line. One leading '-' is included in the number.
* With [b] sorting is done on the first binary number in the line (not originally part of Vim - added for this implementation).
* With [x] sorting is done on the first hexadecimal number in the line. A leading "0x" or "0X" is ignored.
* With [o] sorting is done on the first octal number in the line
* With [u] only keep the first of a sequence of identical lines (ignoring case when [i] is used).
Without this flag, a sequence of identical lines will be kept in their original order.
Note that leading and trailing white space may cause lines to be different.

What's missing from this push:

* No pattern support - I'm struggling on the implementation (using Java regex or translating from Vim's regex)
* No range support - will need to have the command extend a different parent command.
* Hex doesn't support negative (-) signs.

Let me know if you have any questions or suggestions. Thanks!