Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How To Insert Incrementing Numbers with words by Multicursor in jetbrains IDE(IntelliJ IDEA)?

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

like image 420
Shaiful Avatar asked Dec 14 '16 08:12

Shaiful


People also ask

How do I select multiple words in Intellij?

Select multiple words or text ranges While Alt+Shift+Click will add a new caret, double-clicking words or dragging the mouse over text ranges (keeping the same keys pressed) will add new carets with the corresponding selections.

How do I select all occurrences of a word in Intellij?

You can use ⌃⌘G (macOS), or Ctrl+Alt+Shift+J to select all matching words in the document rather than selecting one at a time. You can use ⌃⇧G (macOS), or Alt+Shift+J (Windows/Linux) to remove the selection from the last selected occurrence.

How do I add multiple cursors in Intellij?

Select all occurrences: Ctrl+Cmd+G / Shift+Ctrl+Alt+J. To add or remove multiple carets, you can also press and hold the Alt key, then click at the next location of the caret. Alternatively, to add multiple carets, you can press Alt/Ctrl twice, and then without releasing it, press the Up or Down arrow keys.


2 Answers

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

like image 64
Meo Avatar answered Sep 20 '22 16:09

Meo


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'

like image 22
igonejack Avatar answered Sep 18 '22 16:09

igonejack