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?
For PhpStorm:
You can use the String Manipulation plugin.
To generate numbers in sequence at the multiple carets:
Type in the number to start the sequence with, say 1
, and then select the number.
Open the String Manipulation menu. This is done by
- Alt+M, or
- Alt+Shift+M, or
- Pull Down Menu → Edit → String Manipulation.
In the menu, choose Increment/Decrement → Create sequence.
Here's an animated screenshot:
Screenshot is based on PhpStorm 2016.2 and String Manipulation 5.0.135.445.0.
you can install the emmet plugin for sublime text from the package control.
here is the emmet cheat sheet
Every web developer used it and saves heck a load of time
type ul>li#item-$*5 and press tab and the whole code will be generated :
<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>
There is a plugin called insertNums that does exactly what you are looking for. You can use it to insert a sequence of numbers into the cursors positions.
It also allows you to define some options like the start number and the step between numbers and others.