Implement :sort and ranges.

:sort mainly serving as a way to test the ranges.

Fixes #694.
Fixes #695, at least partially by implementing the parser.
Merge pull request #703 from jhance/sort

Implement :sort and ranges.