Home Download Buy Blog Forum Support

Wrapping text with key bindings

Wrapping text with key bindings

Postby ninjaroll on Sun Mar 11, 2012 7:47 am

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 <ul>, and each line with <li>. For example, selecting the following text:

Code: Select all
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:

Code: Select all
<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:
Code: Select all
<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!
ninjaroll
 
Posts: 31
Joined: Tue Jan 03, 2012 7:10 pm

Re: Wrapping text with key bindings

Postby iamntz on Sun Mar 11, 2012 9:01 am

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.
iamntz
 
Posts: 905
Joined: Fri Apr 29, 2011 8:52 am
Location: Romania

Re: Wrapping text with key bindings

Postby ninjaroll on Sun Mar 11, 2012 6:27 pm

iamntz wrote: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.


Thanks iamntz. I'm aware of that function, but was wondering if there was an exact translation of that feature in ST2.
ninjaroll
 
Posts: 31
Joined: Tue Jan 03, 2012 7:10 pm


Return to Technical Support

Who is online

Users browsing this forum: No registered users and 24 guests