Is there a way to increment numbers when using multiple cursors in Atom?

Daniel says Reinstate Monica picture Daniel says Reinstate Monica · Aug 28, 2015 · Viewed 13.1k times · Source

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?

Answer

nwinkler picture nwinkler · Sep 1, 2015

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