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

Sort​List

by kylebebak ALL

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

Details

Installs

  • Total 1K
  • Win 607
  • Mac 500
  • Linux 275
May 20 May 19 May 18 May 17 May 16 May 15 May 14 May 13 May 12 May 11 May 10 May 9 May 8 May 7 May 6 May 5 May 4 May 3 May 2 May 1 Apr 30 Apr 29 Apr 28 Apr 27 Apr 26 Apr 25 Apr 24 Apr 23 Apr 22 Apr 21 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
Windows 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 1
Mac 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0
Linux 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 2 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.