Sublime Forum

Wrapping text with key bindings

#1

Hello,
I’ve been experimenting with ST2 for quite some time now and may take the leap from Textmate. I have Textmate html snippets ingrained into my brain. There are a few that really stand out that I can’t seem to figure out in ST2.

One snippet is to wrap a text block with

    , and each line with
  • . For example, selecting the following text:
    This is a list item 1
    This is a list item 2
    This is a list item 3

    and hitting control+command+l will give me the option to output this:

    <ul>
       <li><a href="#">This is a list item 1</a></li>
       <li><a href="#">This is a list item 2</a></li>
       <li><a href="#">This is a list item 3</a></li>
    </ul>

    The snippet from Textmate is as followed:

    <ul>
    ${TM_SELECTED_TEXT/.+/   <li><a href="#">$0<\/a><\/li>/g}
    </ul>

    Similarly, how would I go about selecting text, and wrapping it with the “a href” tag?

    Thanks in advance!

0 Likes

#2

There is alt+shift+w (on windows, on mac may differ though).
Also, if you select multiple lines, just press ctrl+shift+L (again, on windows, probably is cmd+shift+L on mac?) will split selection into multiple cursors. Then wrap the selection.

0 Likes

#3

[quote=“iamntz”]There is alt+shift+w (on windows, on mac may differ though).
Also, if you select multiple lines, just press ctrl+shift+L (again, on windows, probably is cmd+shift+L on mac?) will split selection into multiple cursors. Then wrap the selection.[/quote]

Thanks iamntz. I’m aware of that function, but was wondering if there was an exact translation of that feature in ST2.

0 Likes