Home Download Buy Blog Forum Support

Wrap Each Line in HTML Tag (v2)

Wrap Each Line in HTML Tag (v2)

Postby dom111 on Fri Jun 10, 2011 9:02 am

Based on the information provided by adzenith about modifying the cursor location using .sel(), I've made another plugin that I find myself using all the time, wrap each in tag. So if you have the following text:

Code: Select all
  this
  is
    a
  test

And select all the lines and run the function you'll get:

Code: Select all
  <li|>this</li|>
  <li|>is</li|>
    <li|>a</li|>
  <li|>test</li|>

with all the <li>s selected ready for you to overtype with whatever tag you prefer (this is based on TextMate functionality, to help my transition!). You will have to click (or press Escape) to return the cursor to a single position (unless there's another method I don't know about...).

Again, if this is duplicating another plugin/built-in function please let me know! I'd always rather use original functions, than plugins!

You can get it here:

http://dom111.co.uk/files/sublime/plugins/wrap_each.py
dom111
 
Posts: 12
Joined: Wed Jun 08, 2011 9:13 am
Location: UK

Re: Wrap Each Line in HTML Tag (v2)

Postby nerotic on Sun Aug 07, 2011 10:35 pm

Mind telling us how to actually trigger it?

Looks great and I'd find this *very* useful.

Thanks.
nerotic
 
Posts: 5
Joined: Sun Feb 06, 2011 10:14 am

Re: Wrap Each Line in HTML Tag (v2)

Postby jps on Mon Aug 08, 2011 11:01 am

btw, you don't need a plugin to do this:

1. Select the lines of interest
2. Use "Selection/Split into Lines" (Ctrl+Shift+L on Windows and Linux, Cmd+Shift+L on OS X)
3. Use the regular "Wrap Selection with Tag" function from the command palette
jps
Site Admin
 
Posts: 3067
Joined: Wed Mar 19, 2008 12:33 pm


Return to Plugin Announcements

Who is online

Users browsing this forum: Yahoo [Bot] and 14 guests