Surround With Tag, need to be in new lines (both open and close tag)
I use CTRL-W to select this code:
<p>
Sample Text
</p>
Then, CTRL-ALT-T to surround with a DIV tag.
So, I type "div" and then ENTER and I get this:
<div><p>
Sample Text
</p></div>
But I want this formatiing instead:
<div>
<p>
Sample Text
</p>
</div>
I do not want to separate the DIV tag to new lines manually.
Is there a QUICK shortcut to achieve this while entering the TAG?
P.S. I know I can do CTRL-ALT-L afterwards to reformat code, but I wonder if there is an immediate way to achieve the above (I assume common) case.
Thank you.
请先登录再写评论。
Please make sure to check 'Reformat according to style' option in Settings | Editor | Live Templates | html/xml, T2.
See attached screenshot
Attachment(s):
T2.png
Thank you Elena,
your suggestion works, still not all the times.
For example:
no. it's either formatted according to HTML formatting rules, or not formatted at all. In the latter case you are free to add all new lines manually:)
Thanks Elena.