Sublime Forum

Increment 1,1,1,2,2,2,3,3,3

#1

I have a cvs file that I want to Increment three lines with the number 1, then the next three lines with the number two and so on.
I use TextPastry to do my increment, and I love it, but I don’t think it has this functionality.
IE
this is the list I’d like to make…
[1]
[1]
[1]
[2]
[2]
[2]
[3]
[3]
[3]

thanks in advance for any help.

0 Likes

#2

You can do it with Text Pastry. Use the following command:
i 1 1 each=3

First 1 is the init value, second the increment and each= is number of time a line is repeated.

The only thing Text Pastry does not do well is advertising the new features :stuck_out_tongue: Check the readme, from time to time: github.com/duydao/Text-Pastry/b … /README.md

0 Likes

#3

Or do it in the Console like a Python Ninja :wink: :

sublime.set_clipboard("\n".join(str(i) for i in range(1,10) for _ in range(3)))
0 Likes

#4

Or with InsertNums and the format string “3::divmod(_, 3)[0]”

Edit: better " 3::_//3"

0 Likes

#5

Wow. thanks guys! I like Text Pastry, so I’ll have to try that!

0 Likes