46

I want to add Incrementing Numbers with words by Multicursor in jetbrains IDE(IntelliJ IDEA) .

Is there any way to do it by Live template? I want to do things like this image :

enter image description here

yole
  • 87,251
  • 17
  • 245
  • 186
Shaiful
  • 738
  • 9
  • 11
  • There is no such feature in IntelliJ IDEA out of the box that could do something like that. – yole Dec 14 '16 at 09:18
  • 2
    @yole How about making that an answer? Even if "not possible" is probably not the answer the OP hoped for ;-) (BTW I would find that feature useful myself, every now and then.) – Stephen Friedrich Dec 14 '16 at 12:32
  • 2
    Not possible out of the box != not possible. – Meo Dec 14 '16 at 21:27

3 Answers3

81

You could use String Manipulation plugin to do that (Increment/Decrement | Increment duplicates or Create sequence).

Meo
  • 11,291
  • 5
  • 44
  • 51
  • Tried it ... But (7.2.182.000.3 June18, 2019) does not work in Clion 2019.2 ![Failing ScreenshotL](https://drive.google.com/open?id=1aY8zZlXIWj0_SSCSbINhsrSFp84DnwlG). – Andrew Ward Oct 24 '19 at 16:51
  • https://drive.google.com/uc?id=https://drive.google.com/open?id=1aY8zZlXIWj0_SSCSbINhsrSFp84DnwlG – Andrew Ward Oct 24 '19 at 16:52
  • 1
    Thanks! For me, on latest IntelliJ it is Highlight with shift + home, right click, "string manipulation", "Create sequence". – Elijah Lynn May 19 '21 at 15:32
9

The plugin is not working on my WebStorm, there could be another way using unix command line:

seq 1 10 | xargs printf 'string%d\n'

igonejack
  • 2,091
  • 17
  • 26
0

You can actually do that without plugins.

  1. select a list of numbers with your preferred method
  2. copy
  3. select target positions
  4. paste

I select the original numbers by:

  • selecting the rate word
  • ctrl+G (for multi line selection)
  • place the cursor right before the e and the first number (just press right arrow)
  • shift+option+ > (right arrow). That moves to the end of the word while selecting

other option is multicursor with shift+option+cmd+paint selection (macos)

Same in the target.

demo

mayid
  • 1,486
  • 13
  • 23