AnySwap
No description provided
Details
Installs
- Total 277
- Win 206
- Mac 46
- Linux 25
Dec 22 | Dec 21 | Dec 20 | Dec 19 | Dec 18 | Dec 17 | Dec 16 | Dec 15 | Dec 14 | Dec 13 | Dec 12 | Dec 11 | Dec 10 | Dec 9 | Dec 8 | Dec 7 | Dec 6 | Dec 5 | Dec 4 | Dec 3 | Dec 2 | Dec 1 | Nov 30 | Nov 29 | Nov 28 | Nov 27 | Nov 26 | Nov 25 | Nov 24 | Nov 23 | Nov 22 | Nov 21 | Nov 20 | Nov 19 | Nov 18 | Nov 17 | Nov 16 | Nov 15 | Nov 14 | Nov 13 | Nov 12 | Nov 11 | Nov 10 | Nov 9 | Nov 8 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Windows | 0 | 0 | 1 | 1 | 0 | 0 | 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 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Mac | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Linux | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Readme
- Source
- raw.githubusercontent.com
Any Swap
A plugin of Sublime Text 3
that helps user to swap parameters, lines, and expressions from current cursor.
Behaves just like Move-Element-Left/Right
in IntelliJ's IDEs, but more intelligently.
It is based on a general abstract-syntax-tree analyzer that enables user to swap complicated expressions recursively while maintaining a correct operator precedence.
Usage
First of all, install package AnySwap
via Package Control
(not published yet) or clone this repo into your Sublime Text 3/Packages/
folder.
Bind command any_swap
with parameter forward
equals true
or false
to keys that you prefer. The command is set to alt+[
and alt+]
by default.
{ "keys": ["alt+["], "command": "any_swap", "args": {"forward": false} },
{ "keys": ["alt+]"], "command": "any_swap", "args": {"forward": true} },
Place your cursor (|) on the begin/end of a word/paren, then trigger the command.
Features
Parameters:
func(a|, b) => func(b, a|) => func(|a, b)
func(int a|, int b) => func(int b, int a|) => func(|int a, int b)
Lines:
a|, b => b, a| => c, d
c, d c, d b, a|
Math expressions:
a| * b + c => b * a| + c => c + b * a|
(a| + b) * c => (b + a|) * c => c * (b + a)|
Expressions with functions:
func(a| + b, c) * d => func(b + a|, c) * d => func(c, b + a|) * d => d * func(c, b + a)|
Expressions with nested functions:
func(a().b(c| + d), f) => func(a().b(d + c|), f) => func(f, a().b(d + c)|)
Logic expressions:
a| and b or c => b and a| or c => c or b and a|
if a| and b => if b and a|
Array expressions:
a[0|][1] => a[1][0|]
a[b[c| + 1]][0] => a[b[1 + c|]][0] => a[0][b[1 + c]|]
Statements:
a = 1|; b = 2; => b = 2; a = 1;|
return a|, b => return b, a|
Cross-line expressions:
func(a|, => func(b,
b) a|)