text
text
text
text
after the editing, those text becomes to
1 text
2 text
3 text
4 text
It's easy in Notepad ++ with the Column Editor, but I don't know how to do the same in Sublime Text 2.
text
text
text
text
after the editing, those text becomes to
1 text
2 text
3 text
4 text
It's easy in Notepad ++ with the Column Editor, but I don't know how to do the same in Sublime Text 2.
The Text Pastry plugin does the job very well. It offers the Insert Numbers Syntax.
Select multiple lines with CMD+SHIFT+L (Sublime default):
text|
text|
text|
text|
Move the cursor where you want it:
| text
| text
| text
| text
And insert numbers with Text Pastry by hitting CMD+ALT+N and entering 1 space 1 space 0:
1| text
2| text
3| text
4| text
Where 1 space 1 space 0 stands for:
Replace CMD with CTRL on Windows or Linux machines.
copy of this post https://stackoverflow.com/a/64083371/5902698
You want to have a number at each row that you selected, but not the same. For exemple, you select 5 cursors and you want to write 1 2 3 4 5.
select your 5 cursors (maybe you can use the shortcut ctrl + shift + L)
ctrl + shift + P and select arithmetic
Because you have 5 cursors, it propose 1 2 3 4 5
If you want you can change your step of iteration
For this particular case you can use Increment Selection package. Just press Ctrl+Alt+I (Command+Control+I) while having multiple cursors at the beginning of each line. In addition to melinath's answer, here's an example of how to do it:
You will need Package Control first. It shouldn't take more than 30 seconds to install both things.
Steps:
Install Package Control
and click to install.Package Control: Install Package
, click on it and wait a short period.Increment Selection
and click on it to install.Result:
Increment Selection can also replace numbers, prefix numbers with leading zeroes, increment letters, increment by a step and more.
[1] text [1] text [1] -> 1| text 2| text 3|
[a] text [a] text [a] -> a| text b| text c|
[01] text [01] text [01] -> 01| text 02| text 03|
[05,3] text [05,3] text [05,3] -> 05| text 08| text 11|
[5,-1] text [5,-1] text [5,-1] -> 5| text 4| text 3|
Hint: []
stands for a selection, |
stands for a caret.
The IncrementSelection plugin enables this behavior. If you have Package Control installed, you can just search for and install it. Easy peasy!
Use Emmet package try this :
{$ text${newline}}*4
My simple workaround (up until now when I found this thread) was to go to my spreadsheet editor generate the sequence there, copy, back to subl, expand the cursor over however many lines and paste.
This approach can be applied in any text editor that allows you to expand (clone) the cursor.
You can use the plugin ConyEdit to do this, use its command line cc.abl '#1 '
to append before lines with the contents that you want.
@Nicoolasens This answer is great! Just adding one detail: On macOS you can follow these steps to put a curser at the end of each line: