Auto increment number for multiple lines in PhpStorm

Eryk Wróbel picture Eryk Wróbel · Apr 6, 2016 · Viewed 7.7k times · Source

How to achieve auto increment for multiple selection in PhpStorm ie. If I have lines like this selected or taged with multiple cursors

my line das
my line asd
my line sda
my line poi
my line uio
my line kjy

And I want to have them automatically numbered like this

my line das 1
my line asd 2 
my line sda 3 
my line poi 4
my line uio 5
my line kjy 6

Is there any simple method to this with Emmet or any other plugin?

Answer

Harijoe picture Harijoe · Apr 7, 2016

Update: This feature is now available in the String Manipulation plugin v4.5

Old: It's far from ideal, but you can use the Duplicate and increment action from the String Manipulation plugin. It's quite easy to do and it does the job:

enter image description here

Add a shortcut to this action or execute it multiple time to increment a line containing a number.

So far no PhpStorm plugin allows to do exactly what to describe.

It may be the occasion to create one !