Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Auto increment number for multiple lines in PhpStorm

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?

like image 211
Eryk Wróbel Avatar asked Apr 06 '16 08:04

Eryk Wróbel


People also ask

How edit multiple lines Phpstorm?

Press Ctrl+Home to set the caret at the beginning of the first line, enable the column selection mode (press Alt+Shift+Insert ), and then press Ctrl+Shift+End .

How do I select multiple lines in Datagrip?

To select ranges as multiple rectangular selections, Ctrl+Alt+Shift+Click and drag the mouse over the desired parts of code. As a result, you will have multiple selection ranges in each affected document line.


1 Answers

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 !

like image 194
Harijoe Avatar answered Oct 19 '22 22:10

Harijoe