+2
Denegado

Wrap each line of selection in tag

H C hace 13 años actualizado por Jon Skinner hace 11 años 4
Love the new "key binding to wrap the selection in a tag" feature. Please add the ability to select multiple lines and have each line wrapped in a tag. TextMate does this beautifully. I think TM's key binding for this is command+cntrl+shift+w

Respuesta

Respuesta
Denegado
This can be done by first splitting the selection into lines (command+shift+l on osx), and then using the regular wrap selection in tag binding - I don't think a separate binding is desirable in this case.
Respuesta
Denegado
This can be done by first splitting the selection into lines (command+shift+l on osx), and then using the regular wrap selection in tag binding - I don't think a separate binding is desirable in this case.
Wow. Agreed. Didn't realize how the split command worked. Perfect solution. Thanks.

That's a valid solution until the lines you want to wrap are separated by blank lines.  If you select all the lines (including blanks inbetween), it will wrap the blank lines too.


Example...


line 1

[blank line]

line 2

[blank line]

line 3


becomes ...


<p>line 1</p>

<p></p>

<p>line 2</p>

<p></p>

<p>line 3</p>


what we want is ...


<p>line 1</p>

[kept blank]

<p>line 2</p>

[kept blank]

<p>line 3</p>


That's how TM did it.  FYI.


Still love Sublime Text but would LOVE to see this functionality added.


(e)

Yes, Espresso does this too. It was so efficient for me to be able to sweep through the text and use ctr-cmd-shift-w to add and change the tags only on the paragraphs/lines.


In ST2, I've found that by holding down the Cmd key, I can select individual lines or paragraphs and use ctrl-shift-w to do this on my selections.

You could just select it all, wrap it in paragraphs, and then do a search for <p></p> and delete them. That way you get the desired blank lines in only a few seconds!