Last Modified September 28, 2004
BBEdit is an excellent text editor for the Macintosh with a large and loyal following of web designers, programmers, and others who use it for their work. This page focuses on tips and tricks for BBEdit users who use BBEdit for HTML or Perl, but also has some tips that will be useful to anyone who uses BBEdit. The advice on this page may contain some information which is only useful in the Pro version, so keep that in mind if you use the Lite version.
Grep: If you ever have a need to do search and replaces and need more flexibility than the standard search and replace gives you, you should look into using grep. Grep allows you to specify patterns for matching instead of exact matching, and save patterns for use in the replacement. If you don't know how to use grep, read the BBEdit Apple Guide section on it, or this tutorial.
Use the FTP tool: If you work with files on a remote server a lot, you'll find BBEdit's FTP tool very convenient. You can open and save files directly to the server. If you work in a lot of different directories, don't use the autoconnect option since it's faster to tell the tool what directory to go to first and then connect, so you don't have to navigate through the directories. If you're making changes to a lot of files, it's usually faster to upload them in another FTP client in one batch, but if you're making changes to one file and then testing them, such as a perl script, it may be more convenient to save directly to the server rather than stopping to upload each time before testing. Another option for quicker ftp but the convenience of integration with BBEdit is to use Transmit or NetFinder's "Edit in BBEdit" function.
Upgrading to Pro version: If you use BBEdit Lite, and would like to be able to use some of the features of the pro version, such as the HTML Tools Palette and the spell checker, but were discouraged by the price, you should know that Barebones software offers competitive upgrade prices of $40 off the retail price if you use any of the several different software packages listed. BBEdit Lite is one of the programs you can competitively upgrade from, and since it's free, that's a free discount off the Pro version.
Join the BBEdit-Talk mailing list: There's a lot of useful advice and questions answered on the BBEdit-Talk mailing list provided by BareBones Software. See the site for details.
Creating your own extensions: You can use the Custom HTML tool that comes with the HTML Toolbar in the Pro version to create your own extensions. Even if you aren't using BBEdit for HTML, you may find that you can create some useful extensions with the tool. One you've created your extension, you can Save Extension and put it in your BBEdit extensions folder, so it'll be available to you the next time you start BBEdit. (Note: I believe the newer versions of BBEdit no longer allow you to use the Custom HTML tool to create extensions, although you can still use extensions which have been created)
Set Keys for Extensions: If you heavily use certain BBEdit extensions, you should set keys to use for them, so you can use them more quickly, rather than having to go select them each time. If there are a lot you use, you should probably plan out all your key mappings ahead of time before entering them, so you don't end up picking keys you've already used and then have to rearrange the keys you've already set.
Color Coding: BBEdit color codes files of certain types appropriately, to make it easier to pick out certain types of code and errors. You may have noticed that sometimes you don't get the color coding in files because they don't have the appropriate file extensions. In the Preferences, under Function Popup, you can set what type of color coding to use for each file extension, i.e. Perl for .cgi, HTML for .shtml, and so forth. You can also tell it how to treat files that don't match any of those file name extensions.
Twiddle: Ever typed a two characters in the wrong order and realized it and had to go back and delete and retype them? If you realize quick, you can use twiddle to reverse the last two characters, which can be a decent time savings if you make a lot of typos. The command key equivalent for twiddle is command-`.
Includes: BBEdit can expand various built in macros that can include files, put in modification dates, and other useful things. They're described in the manual and well worth reading. You can also look at the included template files for some examples of how they're used. Once you get the hang of using includes, it can really speed up updating of information which is repeated across documents.
Perl Filters: The newer versions of BBEdit include a Perl Filters feature (I believe this was previously available as a separate plugin, and may still be) that will let you create Perl scripts that can be easily applied to files in BBEdit. This if very useful if you have basic Perl skills (or want to learn) and would like to be able to automate some common tasks in Perl. Applescript will also let you automate things, but for those who are already Perl savvy, or people who need really powerful string manipulation support, the Perl Filters are very worth trying out.
Grep: Learning how to use grep for search and replaces can make changes to the HTML on your site much easier. Grep lets you search and replace for patterns, instead of exact matches, which can make it easier to do global changes quickly. If you don't know how to use grep, read the BBEdit Apple Guide section on it, or this tutorial.
HTML Templates: Creating your own HTML Templates in BBEdit can be very useful, especially if you are creating an entire website with the same format on each page. The templates can automatically enter creation dates, creator names, titles, and more when you use the New Document function in the HTML Toolbar. You can also have the template inserted into an existing page, useful when you are redoing a site with a new format.
Create your own extensions: You can create your own extensions using the Custom Markup extension. Make extensions out of tags you use a lot so you can set keys for them and execute them quickly. You can choose save extension once creating your extension to make it an extension file that you can put in your BBEdit extensions folder to be loaded on startup. If you work with a group of people on a site using BBEdit, make a bunch of useful extensions and distribute them. (Note: I believe the newer versions of BBEdit no longer allow you to use the Custom HTML tool to create extensions, although you can still use extensions which have been created)
Drag and drop: You can drag and drop in many ways in BBEdit to make your work easier. You can drag images to your file to have it popup the image tag dialog box, complete with the file name and image size already entered. You can drag a chunk of text from your file to one of the HTML Toolbar's buttons to have it execute that button on the selected text. You can also drag and drop the buttons from the HTML Toolbar to anywhere in your text to execute that function wherever you dragged it to.
HTML Toolbar Functions: There are some really useful functions in the HTML Tools that you may not have noticed or tried. Experiment with them- you may find them quite useful. For instance, there is a format function (under HTML Debugging) which can change how your HTML is formatted, making it more compact, hierarchical, etc. to fit your needs. There is also a table from which you can insert HTML entities for special characters (Entities is under HTML Utilities). Index Document will create an index for you at the top of the document with links to all sections in header tags or A NAME tags, and will automatically create A NAME tags for the headers that don't have them already.
Function popup: The function popup menu at the top gives you quick access to sections of the document that you've marked with A NAME or Header tags.
Balance tags: You can use the Balance Tags option to have everything between the beginning and end of the closest tag selected. Repeated use of Balance Tags will expand the selection to farther out layers of tags. It's a good way to find where you forgot to put that closing tag, to keep track of which section of a table you're in, or other such things that get difficult when you've got a lot of coding going on.
Function Popup: The function popup menu in BBEdit can be quite helpful for perl users to hop quickly to the appropriate section of your program. You may also find it useful to find errors in your code, since functions often disappear from the menu when there are errors in your code, due to the {}'s not terminating properly.
Balance: You can use the balance option in BBEdit (command-b) to see if parenthesis and other container elements balance out properly. It's a good way to trace syntax errors.
MacPerl BBEdit Extensions: There are MacPerl BBEdit extensions available that can help a lot when you're writing perl scripts in BBEdit or using them from within BBEdit. Newer versions of BBEdit Pro include the Perl extensions by default.
Line Formats: If you need to have files in the appropriate line format (Mac, UNIX, or DOS), BBEdit will do the trick. But if you need to change a bunch of files at the same time, it's probably not the most effective way to do it. One program which is good for drag and drop line format changing is Text to Mac. If you're running MacOS 8 or greater, Trygve's CMM Plugins have a contextual menu plugin which will allow you to change the line formats directly in the finder.
Upload and more: If you're uploading a bunch of files at once, BBEdit's save to server option probably isn't the right tool. Any good SFTP client will do just fine though- many these days have BBEdit integration support such as Transmit and NetFinder. If you upload the files in text format, most clients will convert the line format appropriately for the server, and translate any special characters into their equivalents on that platform if you have the translate ISO characters box checked in the preferences. In addition, if your server supports it, many clients can also create directories, move files (by renaming them appropriately), and set permissions (very useful if you're writing scripts which have to be made executable).
Windows: There is no BBEdit for Windows, and it doesn't look like there will be anytime soon. For those poor BBEdit fans forced to use Windows, there are some programs which might be able to fill your need, although I've been told they don't measure up to BBEdit (to give credit where due, there are some nice features they have which haven't made it to BBEdit yet).
UNIX: Unix users generally seem to be quite happy with their text editors, although they've never had BBEdit to choose from. If you need to edit files directly within UNIX, nano, pico, emacs or vi will probably suffice for your needs, and perl or sed will be able to fill any search/replace needs not filled by your editor. For people doing HTML, I've heard the HTML extensions to emacs are pretty good.
Cari D. Burstein - cdaveb AT anybrowser DOT org