Previous Page
Next Page

C.4. BBEdit

BBEdit is a popular commercial text editor for Apple computers, considered by many Mac developers to be the best available. You can read about its extensive features, download a demonstration copy of the application, or purchase a full license for the software from

To configure BBEdit with the extra editor features suggested in this book, you might first need to create some local folders (in order to pre-empt the application's default support folder). See the application's user manual for more information.

Then, adjust your preferences settings. In the Preferences > Editor Defaults screen:

  • Turn on Auto-Indent.

  • Turn on Balance While Typing.

  • Turn on Auto-Expand Tabs.

  • Turn on Show Invisibles.

Adjust your tab stops to four spaces. For BBEdit 7, use the configuration panel under TextFonts&Tabs. For BBEdit 8, the option is under TextShow Fonts.

You can create stationery for any boilerplate file templates you wish to be able to load by using BBEdit to create a file containing the desired code. When the code template is ready, select FileSave As... and turn on the "Save as Stationery" option. Save the file to the folder ~/Library/Application Support/BBEdit Support/Stationery/ and it will then be available from the Stationery palette, or via the standard menu item File"New with Stationery". You might, for example, create the stationery files ~/Library/Application Support/BBEdit Support/Stationery/perl and ~/Library/Application Support/BBEdit Support/Stationery/perl

To use an abbreviation in BBEdit, you need to install a Glossary item. First, create the folder ~/Library/Application Support/BBEdit Support/Glossary/ Then, add a file named debug, with the following contents:

use Data::Dumper qw( Dumper );
warn Dumper [ #SELECT##INSERTION# ];

The Glossary will now contain a debug item whenever a Perl file is opened. Selecting that item will wrap the specified text around the current selection, which will be inserted in place of the #SELECT# marker. The insertion point will then be placed wherever the #INSERTION# marker was, and the marker will be removed.

You can create as many glossary entries as you wish. For example, a ~/Library/Application Support/BBEdit Support/Glossary/ file might contain:

use Benchmark qw( cmpthese );
cmpthese -10, {

    Previous Page
    Next Page