Permute list element/xml attribute

Compatible with: IntelliJ IDEA PhpStorm WebStorm PyCharm RubyMine AppCode CLion GoLand DataGrip Rider MPS Android Studio
Oct 29, 2017
This plugin can swap items in a list left or right. Eg. in a parameter list you can move parameters freely, keeping the format (whitespaces in between elements are kept intact). It works similar to the "Flip" intention when your caret is on a coma, but this plugin
- does not need to stand on the coma, it can stand on the parameter, array item, etc.
- works in free texts and comments (not just psiFiles)
- tries to find the element even if the caret is on whitespace character
- handles selection, so you can move more elements at the same time

The plugin treats comas (',') as element separators, and treats ('()', '<>', '{}', '[]') as list boundaries. Each swap will happen inside these boundaries. However if an element itself has these boundaries, the swap still happens.

Note: The plugin does not deal with unclosed boundary characters inside a string. It will give you a warning about badly formatted string. In this case you can select the whole string and perform the swap without trouble.

The plugin can also rearrange xml attributes in an xml tag. For this it uses a different approach, it uses intellij's psi hierarchy.

The keyboard shortcuts for these two function can be the same, because normally they won't interfere with each other.

Default shortcuts (but I recommend checking them with your current keymap):
- Shift+Alt+K swap list element forward OR swap xml attribute forward
- Shift+Alt+L swap list element backward OR swap xml attribute backward

If you find this plugin useful, please consider inviting me for a beer. I develop this plugin in my free time and I'm more motivated when I have a beer on desk :-)

Recent change notes

1.0 - first release: swap list elements, rearrange xml attributes