Reputation: 3731
In Sublime text, by selecting multiple lines, or Ctrl+clicking multiple lines, I can edit all of them at the same time. What I would like, is that the numbers in those rows would be different; increase with each line.
Currently, for example, I would select 6 lines, press Ctrl+Shift+L to get multiple cursors on each of them, then write for example article > h1 { font-weight:normal; }
, and what comes out is:
article > h1 { font-weight:normal; }
article > h1 { font-weight:normal; }
article > h1 { font-weight:normal; }
article > h1 { font-weight:normal; }
article > h1 { font-weight:normal; }
article > h1 { font-weight:normal; }
And from here, if I want this to apply to all elements from h1
through h6
, I will edit each line manually to change the number.
So my question is, can Sublime Text output an increasing number in each line in this scenario? Or is there another, easier way of changing them manually after they had all been set to 1's?
Upvotes: 6
Views: 5038
Reputation: 1076
Nobody is probably interested in this anymore, but you can do this without any plugins. Put your cursors where you want the numbers to appear. Hit Ctrl+Shift+P to open the command panel, type Arithmetic
and then i + 1
to start at one or simply i
to start at zero. Hit enter.
Upvotes: 6
Reputation: 1372
There are several packages that help you to insert number sequence, including Text Pastry, Insert Nums and so on.
If you use Text Pastry for example, you can achieve what you want by:
article > h
.1
and press enter
.{ font-weight:normal; }
.Step 3 and 4 will insert a sequence 1, 2, ...
into your current selections.
Upvotes: 9