Shuffle variables within selection?
Submitted by Thursday, 19 January, 2012 - 22:03
on
Long time user of Jedit, but only used to the things I do on a regular basis.
It dawned on me today that there might be a macro or plugin for the following, but I am not really sure what it would be called.
Situation:
There is a line of code with a function including 2 or more variables.
eg. foo(A, B, C)
By selecting "A, B, C", is there a way to suffle their order left or right?
The result would be foo(B, C, A) after using the command once.
I ask because to do this using copy/paste normally requires 2 copy/paste operations.
1. Select and copy "A, "
2. Pasting at the end of the statement gives foo(B, CA, )
3. Select and copy ", " and paste it between CA
Shuffling would either be to the left or right, moving the first or last element to the opposite end of the selection. Returning the with all the items still selected would be useful for multiple iterations.
A shuffle tool that was space and comma sensitive would reduce these edits to a single operation. Perhaps there could be a setting to tell the command what characters represent variable separators (comma, space, math operators, colons, etc)
Having this work for collumn selections would be useful too.
Maybe I'm a lazy coder
It dawned on me today that there might be a macro or plugin for the following, but I am not really sure what it would be called.
Situation:
There is a line of code with a function including 2 or more variables.
eg. foo(A, B, C)
By selecting "A, B, C", is there a way to suffle their order left or right?
The result would be foo(B, C, A) after using the command once.
I ask because to do this using copy/paste normally requires 2 copy/paste operations.
1. Select and copy "A, "
2. Pasting at the end of the statement gives foo(B, CA, )
3. Select and copy ", " and paste it between CA
Shuffling would either be to the left or right, moving the first or last element to the opposite end of the selection. Returning the with all the items still selected would be useful for multiple iterations.
A shuffle tool that was space and comma sensitive would reduce these edits to a single operation. Perhaps there could be a setting to tell the command what characters represent variable separators (comma, space, math operators, colons, etc)
Having this work for collumn selections would be useful too.
Maybe I'm a lazy coder