SortBy
A Sublime Text plugin that allows you to sort lines with methods that are not present by default.
Details
Installs
- Total 19K
- Win 8K
- Mac 7K
- Linux 4K
| Oct 31 | Oct 30 | Oct 29 | Oct 28 | Oct 27 | Oct 26 | Oct 25 | Oct 24 | Oct 23 | Oct 22 | Oct 21 | Oct 20 | Oct 19 | Oct 18 | Oct 17 | Oct 16 | Oct 15 | Oct 14 | Oct 13 | Oct 12 | Oct 11 | Oct 10 | Oct 9 | Oct 8 | Oct 7 | Oct 6 | Oct 5 | Oct 4 | Oct 3 | Oct 2 | Oct 1 | Sep 30 | Sep 29 | Sep 28 | Sep 27 | Sep 26 | Sep 25 | Sep 24 | Sep 23 | Sep 22 | Sep 21 | Sep 20 | Sep 19 | Sep 18 | Sep 17 | Sep 16 | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Windows | 1 | 1 | 4 | 1 | 2 | 2 | 1 | 0 | 3 | 2 | 2 | 6 | 0 | 0 | 2 | 2 | 0 | 2 | 1 | 1 | 0 | 1 | 1 | 1 | 4 | 0 | 0 | 0 | 2 | 4 | 0 | 1 | 5 | 1 | 3 | 3 | 2 | 1 | 1 | 0 | 0 | 0 | 3 | 1 | 1 | 2 | 
| Mac | 1 | 2 | 1 | 1 | 3 | 2 | 0 | 1 | 0 | 3 | 0 | 1 | 2 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 1 | 0 | 1 | 1 | 1 | 0 | 0 | 1 | 1 | 1 | 3 | 0 | 0 | 1 | 1 | 2 | 1 | 1 | 3 | 0 | 1 | 2 | 
| Linux | 0 | 0 | 0 | 2 | 1 | 0 | 0 | 0 | 2 | 1 | 2 | 2 | 0 | 0 | 1 | 4 | 2 | 1 | 1 | 2 | 1 | 1 | 0 | 0 | 1 | 3 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 1 | 0 | 2 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 
Readme
- Source
- raw.githubusercontent.com
SortBy
A Sublime Text plugin that allows you to sort lines with methods that are not present by default.
Feature matrix
| Features | ST2 | ST3 | ST4 | Description | 
|---|---|---|---|---|
| Natural order | x | x | x | Sort the lines using the natural order, you can read more in an excellent article by Jeff Atwood. | 
| Sort by the length of lines | x | x | x | |
| Sort lines of text alphabetically | x | x | x | |
| Sort numbers numerically | x | x | x | |
| Semantic Versioning | x | x | Sort Semantic Versions, not supporting pre-releases / build metadata at the moment. | |
| Regular expression | x | x | Sort the lines using a regex, to find the component and choose a subsort for the line. | 
You can check the backward-incompatible-changes file to see if you need to do something to keep your current settings / workflow.
- Able to sort the entire file (when there is no selection)
- Case sensitivity option for the alphabetically sortmethod (Editable in SortBy.sublime-settings)
Installation
With Package Control
CTRL + SHIFT + P on Windows/Linux.
COMMAND + SHIFT + P on OS X.
and type SortBy in the box.
Manual installation
- Find your local Sublime Text Packagesdirectory.
- Copy the SortBy directory inside the Packages directory.
- Restart Sublime Text and enjoy !
How to use
- Select the text you want to sort.
- Go in the menu Tools,Packagesthen you should seeSortBy.
- Choose your option. (Either Reverse or normal).
Settings
Sorts
handle_selected_part_of_line_as_full_selected_line
Enable this (true) to ignore the start & end of the selection; any line that is touching the selection, will be sorted.
alphabetically_case_sensitive
Enable this (true) to sort with the case sensitivity (the lower and the upper cases will be sorted in two different groups).
Subsorts
Length of lines
This Subsort is disabled by default.
You can sort the line of the same length alphabetically.
To enable this subsort, add the subsort_length_of_line property with the value ALPHABETICALLY OR ALPHABETICALLY_DESCENDING in the plugin settings.
Key Bindings
Create the file
- In the Preferencesmenu
- Go to Package settings
- Go to SortBy
- Click on Key Bindings - User
This will open / create a key bind file for the entire application.
Change the key binding
When the file is created or opened, you need to override the key binding that you want.
- Copy the key binding from Default.sublime-keymap that you want to override (copy the entire JSON object). Example
{
    "caption": "SortBy: Natural order",
    "keys": [
      "ctrl+shift+alt+q"
    ],
    "command": "srtbyli",
    "args": {
      "sort": "natural_order",
      "reversed": false
    }
  }
In this example, the key bind is ctrl+shift+alt+q
- With the JSON object in your clipboard, add it to the created file, by making sure to wrap it in a JSON array ([...]). Example
[  
  {
    "caption": "SortBy: Natural order",
    "keys": [
      "ctrl+shift+alt+q"
    ],
    "command": "srtbyli",
    "args": {
      "sort": "natural_order",
      "reversed": false
    }
  }
]
- Change the keysto the key binding that you want.
Disable the old key binding
If the old key binding is causing issues, you can disable it with the following JSON objet; just add it to the created file.
{
    "keys": [
      "ctrl+shift+alt+u"
    ],
    "command": "noop"
  }