Is there a quick way to insert sequential numbers into multiple options?

When working with HTML identifiers, it is often necessary to create elements with the same identifier names, but with a 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 several cursors. Is there a way to insert numbers from 1-5?

+4
source share
3 answers

For PhpStorm :

You can use the String Manipulation plugin .

To generate numbers sequentially in multiple patterns :

  • , , 1, .

  • String Manipulation.

    • Alt + M,
    • Alt + Shift + M,
    • → → .
  • Increment/Decrement → Create sequence.

: PhpStorm 2016.2 String Manipulation 5.0.135.445.0.

+4

emmet . - -


ul > li # item - $* 5 , :

<ul>
  <li id="item-1"></li>
  <li id="item-2"></li>
  <li id="item-3"></li>
  <li id="item-4"></li>
  <li id="item-5"></li>
</ul>
+4

There is a plugin called insertNums that does exactly what you are looking for. You can use it to insert a sequence of numbers at the cursor position.

It also allows you to define some parameters, such as the start number and the step between numbers and others.

+2
source

Source: https://habr.com/ru/post/1618858/


All Articles