ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

Sort​List

by kylebebak ST2/ST3

Cross-language plugin for sorting items in comma-separated lists

Details

Installs

  • Total 453
  • Win 195
  • OS X 169
  • Linux 89
Apr 20 Apr 19 Apr 18 Apr 17 Apr 16 Apr 15 Apr 14 Apr 13 Apr 12 Apr 11 Apr 10 Apr 9 Apr 8 Apr 7 Apr 6 Apr 5 Apr 4 Apr 3 Apr 2 Apr 1 Mar 31 Mar 30 Mar 29 Mar 28 Mar 27 Mar 26 Mar 25 Mar 24 Mar 23 Mar 22 Mar 21 Mar 20 Mar 19 Mar 18 Mar 17 Mar 16 Mar 15 Mar 14 Mar 13 Mar 12 Mar 11 Mar 10 Mar 9 Mar 8 Mar 7
Windows 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 1 0 0 0 0 0 0 3 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 1 0
OS X 1 1 0 0 1 0 0 0 1 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 2 0 0 0 0 0 0 0 2 0 0 0 1 3 0
Linux 0 0 1 0 0 0 0 1 0 0 1 0 0 1 5 3 4 1 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

Readme

Source
raw.​githubusercontent.​com

SortList

A cross-language Sublime Text plugin for sorting items in a list. Handles lists without opening and closing list delimiters, and lists with trailing commas. Preserves lists' quote style (single vs. double).

Demo

Installation

From Package Control

SortList is available via Sublime Package Control. This is the recommended way to install the plugin.

From GitHub

Alternatively, you may install via GitHub by cloning this repository into the Packages directory under Sublime Text's data directory. For example, on OSX:

cd "~/Library/Application Support/Sublime Text 3/Packages"
git clone https://github.com/kylebebak/sublime_sort_list.git

Usage

Highlight one or more lists and run the command. If the lists can't be sorted exceptions with line numbers will be displayed in the quick panel.

The name of the command is sort_list. It appears in the Command Palette as Sort List. If you want to use it with a minimum of hassle add a shortcut to your .sublime-keymap.

{ "keys": ["shift+alt+super+o"], "command": "sort_list" }

If you want to change the list delimiter characters, override SortList.sublime-settings.

Tests

From the root directory, run python3 -m unittest discover --verbose. Some of the tests will fail in Python 2, but the plugin still works fine in Sublime Text 2.

Contributing

Fork it and create a pull request.

Wish List

  • reinsert leading and trailing whitespace, including new lines, after sorting the list
  • allow for list delimiters with more than one character, e.g. <% and %>.

License

This code is licensed under the MIT License.