On Oct 26, 2015, at 08:46, Vlad Ghitulescu <[email protected]> wrote:
>> Type Command-B (View -> Balance), then paste. :-)
> 
> Ha! That’s amazing! Thanks, Patrick!
______________________________________________________________________

Hey Vlad,

If you do that a lot you can save a keystroke.

-------------------------------------------------------------------------------------
# Cursor must be inside the tags.
-------------------------------------------------------------------------------------
tell application "BBEdit"
  balance tags
  paste
end tell
-------------------------------------------------------------------------------------

Getting a little fancier we can do the same thing with the cursor anywhere on 
the line.

-------------------------------------------------------------------------------------
# Cursor may be anywhere in the line.
-------------------------------------------------------------------------------------
tell application "BBEdit"
  tell (front text window's line (startLine of selection))
    select insertion point after character (endLine of (first character of it 
whose contents is ">"))
    balance tags
  end tell
  paste
end tell
-------------------------------------------------------------------------------------

This is overkill if you don't do this task a lot, but it demonstrates how 
simple this sort of thing is to do with BBEdit's excellent AppleScript support.

--
Take Care,
Chris


-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email
"[email protected]" rather than posting to the group.
Follow @bbedit on Twitter: <http://www.twitter.com/bbedit>

--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].

Reply via email to