On Sat, 30 Sep 2006 15:59:16 +0100, Charles Payne wrote
(in message <[EMAIL PROTECTED]>):

> Thought I'd ask this question again.  Thanks.
> 
>> Is there  a way to have BBEdit automatically type the corresponding
>> closing character when you open a set of parantheses, braces, quotes,
>> etc.?  I know there was an input plugin called AutoPairs, but that
>> would work only on non-Intel Macs.
>> 
>> Thanks

I'm very new to this forum and BBEdit but what I don't understand about your 
question is how is it going to know when to put the closing parenthesis in if 
it is to do it while typing?

Howabout a script which puts parentheses around a selection?

If you put

.+

in the find part of the find dialogue this will find 1 or more characters in a 
string which doesn't include the return character.

then put

(&)

in the replace part, the & simply replicates all that was "found" by .+ and by 
putting ( and ) on each side then you have put brackets around the original 
found text.

In the find/replace dialogue select "Search Selection Only" and of course "use 
GREP".

now it will put ( and ) around the selection.

The AppleScript version is:

tell application "BBEdit"
replace ".+" using "(&)" searching in selection of text window 1 options 
{search mode:grep, extend selection:false}
end tell

All you need to do then is create one for each form of parenthesis by changing 
the relevant bit in the replace expression.

You can save each of these scripts in your BBEdit Scripts folder.

If you want the AppleScript to insert " around the selection then you need to 
escape that by using \ so you would have this:

replace ".+" using "\"&\""




-- 
Patrick



-- 
------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <[EMAIL PROTECTED]>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to:  <[EMAIL PROTECTED]>

Reply via email to