65

Animated GIF showing input being typed into an editor. The letter 'a' is on six separate lines. The lines are all selected. The text "my repetitive task 1" is typed and appears on all six lines at the same time. The 1 on line 2 is changed to 2, the 1 on line 3 is changed to 3 and so on.

I find myself doing this over and over again. It can be pretty time consuming. What options are available for this?

1
  • I have made a package that does this! simple add some cursors, ctrl-alt-n, and numbers are inserted from 0 and up. if want a more customised insertion, ctrl-alt-0 will open up a dialog box, where you type in M:N, where M is the number to start counting from, and N is the increment value. For example 1:2 will insert positive odd numbers. atom.io/packages/multiple-cursors-functions Commented Aug 7, 2018 at 16:24

4 Answers 4

56

The Increment Selection package might be what you're looking for. It seems to be working with multiple cursors, so should be pretty close to your use case:

Select a block of text and hit ctrl-shift-i to replace it with incrementing numbers

  • Uses first line's number if any
  • Works with multiple cursors

Increment Selection Demo

0
9

or you may try emmet

{item$$, }*3 will transform to item01, item02, item03,

P.S. I am using atom.io, didn't know if it works on sublime-text or other editor.

1
  • YES! A THOUSAND TIMES YES! No plugins or other nuts required for this. Wish I could upvote again.
    – 17xande
    Commented Aug 3, 2023 at 11:48
9

for those who google this feature for VS CODE editor and end up here (like me), here is vscode plugin. Thank you anyway for getting name of the feature here 😊👍

8

There are a few others available now too. Increment Selection hasn't been touched in 2 years.

Newest and most robust seems to be: https://atom.io/packages/multi-cursor-increment

It can set things to incremental numbers and even move everything up or down by 1 afterwards.

Another option: https://atom.io/packages/increment-me

1

Not the answer you're looking for? Browse other questions tagged or ask your own question.