Last Updated: September 09, 2019
·
6.424K
· chhuang

[Sublime Text] Wrap multiple lines in tag

How to turn:

apple
orange
strawberry
pineapple

into

<li>apple</li>
<li>orange</li>
<li>strawberry</li>
<li>pineapple</li>
  1. Select the lines of interst
  2. command + shift + L
  3. control + shift + W
  4. Type your tag

2 Responses
Add your response

Really awesome. Didn't know about this so far. Really handy!

over 1 year ago ·

Glad it helps! The problem with this approach is when your code is indented. If you select and drag the whole line for step 1, step 3 will add the tags at the beginning of each line (leaving an empty space after the new tag).

A better solution for this will be:

  1. Select the line of interest while holding down option
  2. control + shift + W
  3. Type your tag
over 1 year ago ·