Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a fast way to paste consecutive numbers in multiple selection?

When working with HTML ids it is often necessary to create elements with same id names, but different numeric index, for example:

<ul>
   <li id="item-|"></li>
   <li id="item-|"></li>
   <li id="item-|"></li>
   <li id="item-|"></li>
   <li id="item-|"></li>
</ul>

"|" - represents one of the multiple cursors. Is there a way to paste numbers from 1-5 there?

like image 638
Boykodev Avatar asked Dec 18 '22 21:12

Boykodev


1 Answers

For PhpStorm:

You can use the String Manipulation plugin.

To generate numbers in sequence at the multiple carets:

  1. Type in the number to start the sequence with, say 1, and then select the number.

  2. Open the String Manipulation menu. This is done by

    • Alt+M, or
    • Alt+Shift+M, or
    • Pull Down MenuEditString Manipulation.
  3. In the menu, choose Increment/DecrementCreate sequence.

Here's an animated screenshot: Screenshot is based on PhpStorm 2016.2 and String Manipulation 5.0.135.445.0.

like image 62
Pang Avatar answered Jan 13 '23 16:01

Pang