4
votes

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?

1

1 Answers

6
votes

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:

  1. Select 6 lines.
  2. Type article > h.
  3. Press ctrl/cmd+alt+n to open the Text Pastry command line.
  4. Enter 1 and press enter.
  5. Type { font-weight:normal; }.

Step 3 and 4 will insert a sequence 1, 2, ... into your current selections.