On Nov 7, 2008, at 6:10 AM, Alfred Newmann wrote:

> - What shall I do to BBEdit close the opened quotes, doubles quotes,
> curly braces and etc automatically;

I'm a longtime BBEdit user, but I tried TextMate for a 6-month project  
in 2007. At first, I liked the automatic closing of quotes and braces.  
But after a while, I got tired of TextMate inserting a closing  
character when I didn't want it. Sometimes it would work beautifully,  
but the rate at which it would do the wrong thing far outweighed the  
positives. Fortunately, I found it could be turned off in TextMate's  
preferences.

Anyway, I returned to BBEdit and came up with a better solution (at  
least for me). I created a collection of clippings that wrapped the  
current selection in the specified symbols (quotes, braces, etc.),  
like this one called "Wrap in Single Quotes":

'#selstart##select##selend#'

I then assigned a keyboard shortcut to each of the clippings and  
stored them in BBEdit's Universal collection so they'd always be  
available, regardless of source language.

I like using Control-Command-<symbol> because the Control and Command  
keys straddle the Option key on either side and help me remember that  
this combination is going to do the same for the symbol I type (e.g.  
Control-Command-' will straddle the selection with single quotes).

Once I got used to this system, I vastly preferred it to TextMate's  
implementation. I can easily enter a pair of opening and closing  
symbols with the cursor automatically placed between them. Or I can  
apply the opening and closing symbols to existing text by simply  
selecting it and hitting my shortcut. And I've never had a closing  
symbol inserted when I didn't want it!

--Extra Credit--

To add another TextMate feature, I wrote a simple AppleScript that  
toggles the nearest enclosing quotes between single and double. It  
does this by searching backward and forward for a matching pair and  
then swaps them from single to double, or double to single. It's  
particularly handy when working with PHP, where the type of quotes  
used can make a big difference in how your code behaves.

You can find this script, and others, at:

http://homepage.mac.com/dennisrande/FileSharing41.html


> - What should I do to automatic indentation when write scripts,
> specially in Python, exemple, when I do a "if something:" I would like
> the next line is indented...

First off, you can turn on Auto-indent in BBEdit's preferences (Editor  
Defaults -> Auto-indent). From the page 207 in the manual:

    When this option is selected, pressing the Return key
    in new windows automatically inserts spaces or tabs to
    indent the new line to the same level as the previous line.

But I don't think this is exactly what you're asking for. You want to  
automatically enter a new line and indent the cursor x number of  
spaces when you open an if statement in Python, right?

I think the best way to do this is to create a BBEdit clipping for  
Python if statements that positions the cursor where you want it.  
Then, when you're creating a new if statement in your code, just hit  
your text completion keyboard shortcut (like to use the Escape key) or  
use the Insert Clipping command (Control-Return on my system).

I don't write much Python, but here's a similar clipping I use for PHP:

if (#selstart#condition#selend#)
{
    #selection#
}

Hope this helps!

-Dennis


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "BBEdit Talk" group.
To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/bbedit?hl=en
If you have a specific feature request or would like to report a suspected (or 
confirmed) problem with the software, please email to "[EMAIL PROTECTED]" 
rather than posting to the group.
-~----------~----~----~----~------~----~------~--~---

Reply via email to