Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

atom-editor

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?

like image 371
Daniel says Reinstate Monica Avatar asked Aug 28 '15 15:08

Daniel says Reinstate Monica


People also ask

How do you edit multiple lines in an atom on a Mac?

Select all text ( Cmd + A on Mac, Ctrl + A elsewhere), then use the shortcut to “split the selection into lines” ( Cmd + Shift + L on Mac, Ctrl + Shift + L elsewhere). Both commands are also available from the command palette.


1 Answers

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

like image 77
nwinkler Avatar answered Sep 21 '22 15:09

nwinkler