Last week I wrote that you can sort lines of text alphabetically in Sublime Text 3. Whilst playing with features under the Edit menu, I happened across the Permute Lines menu. Here's what it does.
Permute Lines
Under Edit > Permute Lines, there are three permutations you can choose from. Each one manipulates the selected lines a certain way. The options are: Reverse, Unique, and Shuffle.
Let's say you have the following text in a file, sorted alphabetically:
Apples Apples Bananas Grapes Lemons Limes Limes Oranges Pineapples
The first permutation, called Reverse, simply reverses the order of the list. Here's what the resulting text looks like:
Pineapples Oranges Limes Limes Lemons Grapes Bananas Apples Apples
The second one is called Unique. This one may not be as obvious, but it removes duplicate lines. Now the list looks like this:
Pineapples Oranges Limes Lemons Grapes Bananas Apples
The last permutation is called Shuffle. Similar to PHP's shuffle() function, this one randomizes the order of each line. An example looks like this:
Oranges Apples Pineapples Lemons Limes Grapes Bananas
Permute Selections
You can also apply the same permutation methods to selections. That is, when you make multiple selections, you can sort, reverse, shuffle, and remove duplicates by using the Edit > Permute Selections menu.
I haven't really found a need for these ones yet, but I'm sure they'll come in handy at some point.
Did you know about these features? Have you done anything useful with them?