ColumnMassage
A Sublime Text 3 Plugin which rearranges columns of text to meet you needs.
Details
Installs
- Total 245
- Win 137
- Mac 73
- Linux 35
Oct 12 | Oct 11 | Oct 10 | Oct 9 | Oct 8 | Oct 7 | Oct 6 | Oct 5 | Oct 4 | Oct 3 | Oct 2 | Oct 1 | Sep 30 | Sep 29 | Sep 28 | Sep 27 | Sep 26 | Sep 25 | Sep 24 | Sep 23 | Sep 22 | Sep 21 | Sep 20 | Sep 19 | Sep 18 | Sep 17 | Sep 16 | Sep 15 | Sep 14 | Sep 13 | Sep 12 | Sep 11 | Sep 10 | Sep 9 | Sep 8 | Sep 7 | Sep 6 | Sep 5 | Sep 4 | Sep 3 | Sep 2 | Sep 1 | Aug 31 | Aug 30 | Aug 29 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Windows | 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 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 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 | 1 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Readme
- Source
- raw.githubusercontent.com
ColumnMassage
A Sublime Text 3 Plugin which rearranges columns of text to meet you needs.
Feature
See below demonstration.
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:
<li><span class="filename">20180315225757.png</span><span class="extension">.png</span><span class="length">67445</span></li>
<li><span class="filename">20180624001029.jpg</span><span class="extension">.jpg</span><span class="length">307811</span></li>
<li><span class="filename">Edde.png</span><span class="extension">.png</span><span class="length">10490</span></li>
<li><span class="filename">email address.png</span><span class="extension">.png</span><span class="length">48782</span></li>
First we select the lines:
Then we press Ctrl + Shift + ~
to invoke ColumnMassage
command.
Now we create a rule to tell the plugin how to manipulate the text.
Press Enter
and we are done.
How to read the rule
In the above example, we use the rule ,|||((|||))|||<li><span class="filename">((1))</span><span class="extension">((2))</span><span class="length">((3))</span></li>
.
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.<li><span class="filename">((1))</span><span class="extension">((2))</span><span class="length">((3))</span></li>
This part is the actual rule. You can use column templates in it. A column template looks like<left_string><column_number><right_string>
. In our example,<left_string>
is((
and<right_string>
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, Version 2, as published by Sam Hocevar. See the COPYING file for more details.