Section C.4.  BBEdit

Table of Contents

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 http://www.barebones.com/products/bbedit/.

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 TextSection C.4.  BBEditFonts&Tabs. For BBEdit 8, the option is under TextSection C.4.  BBEditShow 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 FileSection C.4.  BBEditSave 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 FileSection C.4.  BBEdit"New with Stationery". You might, for example, create the stationery files ~/Library/Application Support/BBEdit Support/Stationery/perl application.pl and ~/Library/Application Support/BBEdit Support/Stationery/perl module.pm.

To use an abbreviation in BBEdit, you need to install a Glossary item. First, create the folder ~/Library/Application Support/BBEdit Support/Glossary/Perl.pl/. 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/Perl.pl/benchmark file might contain:

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

    Table of Contents
    © 2000- NIV