ColumnMassage
=============
A Sublime Text 3 Plugin which rearranges columns of text to meet you needs.
## Feature
See below demonstration.
![](https://raw.githubusercontent.com/yangshuairocks/ColumnMassage/master/column_massage.gif)
## Shortcuts
This plugin has only one shortcut `Ctrl + Shift + ~`.
## How to use
Let's say we have some a csv file with the following content.
```
20180315225757.png,.png,67445
20180624001029.jpg,.jpg,307811
Edde.png,.png,10490
email address.png,.png,48782
```
We want to arrange the text to this:
```
20180315225757.png.png67445
20180624001029.jpg.jpg307811
Edde.png.png10490
email address.png.png48782
```
First we select the lines:
![](https://raw.githubusercontent.com/yangshuairocks/ColumnMassage/master/howto_step1_select_all.png)
Then we press `Ctrl + Shift + ~` to invoke `ColumnMassage` command.
![](https://raw.githubusercontent.com/yangshuairocks/ColumnMassage/master/howto_step2_call_column_massage.png)
Now we create a rule to tell the plugin how to manipulate the text.
![](https://raw.githubusercontent.com/yangshuairocks/ColumnMassage/master/howto_step3_create_rule.png)
Press `Enter` and we are done.
![](https://raw.githubusercontent.com/yangshuairocks/ColumnMassage/master/howto_step4_done.png)
## How to read the rule
In the above example, we use the rule `,|||((|||))|||((1))((2))((3))`.
Here `|||` is the rule delimiter and we should not change it. So the rule was separated into 4 parts.
- `,`
This is the text column delimiter and will be converted into a Python regular expression. In the above example we are using csv syntax, so we specify `,` as the delimiter. Common column delimiters are `\t+`, `\s{2,}`, `\s+` etc.
- `((`
This is the text that denotes the left side of a column template. See below.
- `))`
This is the text that denotes the right side of a column template. See below.
- `((1))((2))((3))`
This part is the actual rule. You can use column templates in it. A column template looks like ``. In our example, `` is `((` and `` is `))`. Except the column templates, other parts of the rule will be inserted literally without any change.
## Installation
Clone this repository into Sublime Text "Packages" directory.
## License
Copyright © 2018 Yang Shuai
This work is free. You can redistribute it and/or modify it under the terms of the [Do What The Fuck You Want To Public License](http://www.wtfpl.net), Version 2, as published by Sam Hocevar. See the [COPYING](https://github.com/yangshuairocks/ColumnMassage/blob/master/COPYING) file for more details.