Though it pained me at the time, last year I felt compelled to leave my favorite text editor-- BBEdit-- for TextMate. I had been using BBEdit for years and years as my IDE, but when I made the move to Ruby on Rails I followed the lead of other Mac-based Rails developers and adopted TextMate. Although the move was relatively painless, something just didn't feel right.

I won't do a feature-by-feature comparison, but I will say that while the Rails-specific features were nice, there were a lot of BBEdit niceties that I missed, or whose TextMate analogues I found lacking.

So when Bare Bones released BBEdit 9 a couple of months ago, I decided to test the waters and see if I could return to my old favorite without losing the productivity gains I got with TextMate. I'm happy to say that I haven't opened TextMate at all since then. I initially stumbled across (and reported) a few bugs related to the handling of Ruby in the editor, but was amazed at the incredibly fast response and turnaround time for fixes.

Project Management

Besides the extended Ruby on Rails language support, probably the most important BBEdit feature from a Rails development perspective is the new Project functionality. Long-time BBEdit users will probably recognize this as an evolution of the Disk Browser feature.

Projects are basically a group of related files and folders from the file system. So in a typical Rails app, the BBEdit Project file would contain all of the files and folders in your application's root directory.

Projects provide single-window editing capability, which is vital while working across model, view, helper, and controller files. You can slide open the Documents Drawer to see all of the docs you've got open, and move between them using a keyboard shortcut; I think that command-] and command-[ are the defaults.


BBEdit's Project window BBEdit's Project window...
TextMate's project interface ...compared to TextMate's interface.

This pretty much parallels TextMate functionality, with the exception that Project files and folders are not limited to a single root folder. You can also create Collections within projects, so if you have conf files related to your project (e.g. host files, vhosts, or what have you) you can maintain quick access to them from the Project window.

To create a Project in BBEdit, simply go to New -> Project, and then drag-and-drop your files and folders. You can save the Project file wherever you like-- I keep all of the BBEdit Project files in my ~/Documents/projects/ folder, at the same level in the file hierarchy as my Git repositories. This keeps them easy to access but out of source control.

Scoping Multi-File Search

BBEdit has always provided fast and robust search capabilities, especially compared to the dog-slow multi-file searching in TextMate.You also now have ability to edit right from within the search results list. Nice. But take a few minutes to optimize the way you search, and you'll be even more productive.

In the multi-file search dialog, set up a File Filter defining Rails source code as any file with one of the following line endings:

Then click 'Other' in the find dialog box and select just the folders you're going to want to search in (most likely app/models, app/views, app/controllers, and app/helpers). Otherwise, you may find yourself with a lot of false positives as BBEdit searches through log/, lib/, and vendor/. Be sure to save your search set and name it for your project.

Clippings

Clippings make short work of Rails coding in BBEdit. Clippings are just snippets of code that can be inserted with a few key presses, and BBEdit 9 comes with two sets just for Rails development: Ruby, and Ruby in HTML. Create a keyboard shortcut for the Clippings > Insert Clipping menu item by bringing up Preferences > Menus > Clippings and selecting Insert Clipping. (I use option-command-c.)

To insert a clipping, simply invoke the clipping pallete using your shortcut, and start typing the clipping tag that you want; for example, to insert a template for a class definition, start typing "cla", and when auto-complete shows the correct clipping, just hit enter.

Now you can tab through the placeholders (in this case, the ClassName and the interior of the class) and enter the appropriate code.

You can also create your own snippets; check the BBEdit help for instructions.

I've created a quick reference sheet that organizes all of the Rails-related clippings on one page, suitable for hanging on the wall near your desk:

Related Articles


Comments

Dennis
November 5, 2008 at 12:55 PM

You wrote: "Long-time BBEdit users will probably recognize this as an evolution of the Disk Browser feature." Actually, I think the new Project feature in BBEdit 9 is an evolution of the long-standing File Groups feature. In fact, I think Projects and the legacy File Groups are virtually identical, except for the addition of the attached editing window and some UI polish in the new Projects window. BBEdit 9 still has the Disk Browser too, but it's a distinctly different feature that mirrors the directory structure of a drive (whereas File Groups and Projects contain an arbitrary collection of files that can be located anywhere). Anyway, nice post and welcome back to BBEdit. ;-)

Christopher J. Bottaro
November 6, 2008 at 4:25 AM

You're right, TextMate's "Find in Project" feature is piss poor. I cannot believe it lacks the feature to not/only search certain directories or file name patterns. Going to give BBEdit a try now, thanks for the post.

salamander
December 17, 2008 at 5:46 AM

I've been straddling the fence between Textmate and BBEdit for the past few months and am still torn. There are some things I'm still trying to figure out in BBEdit's Project. Woul you happen to know the BBEdit equivalent of Textmate's command-t command?

Cheat Sheets with BBEdit » Idol Hands: Days in the Life of an Alpha Geek
December 20, 2008 at 4:53 PM

[...] came out, Ed Silva released a little script for integrating Cheat into TextMate. Since I’ve switched back to BBEdit for my Rails development, I decided to do something similar for [...]

Corey Ehmke
December 20, 2008 at 5:12 PM

salamander, I was missing that command-T functionality, too. I wonder if the folks at Bare Bones are reading my blog. Hmm. As of the latest BBEdit update (9.1), it's easy to open a file within your project by name. If you have a project window open, invoke Open File by Name with command-d and BBEdit will look in the project for matches. Note that if you have something selected in a window, the context shifts to Open Selection, which is probably not what you want. You should be able to modify the keyboard shortcut to change this behaviour.

Stefan Seiz
February 11, 2009 at 2:13 AM

Hi, in case someone is missing the Ruby Clippings with his installation like i did, you can download the Standard BBedit Clippings which include the Ruby Clippings here: http://www.barebones.com/files/BBEdit90FactoryClippings.dmg

mattmartini
June 7, 2009 at 9:45 AM

Corey, I too recently switch back to BBEdit from TextMate for Rails development. To help my transition, I created two clipping sets. One with much more complete CSS coverage than what is supplied with BBEdit and one for SASS which includes support for Compass and Blueprint (via compass). They also have the unique feature of providing hints as to the typical option choices in the placeholders. They can be downloaded at the URLs below: (Each of the two sets is provided in .zip, .tar.gz, and .tar.bz2 formats and there is a gpg signature file for each.) http://www.imaginarywave.com/Clippings/CSS_extended.css.README http://www.imaginarywave.com/Clippings/CSS_extended.css.tar.bz2 http://www.imaginarywave.com/Clippings/CSS_extended.css.tar.bz2.asc http://www.imaginarywave.com/Clippings/CSS_extended.css.tar.gz http://www.imaginarywave.com/Clippings/CSS_extended.css.tar.gz.asc http://www.imaginarywave.com/Clippings/CSS_extended.css.zip http://www.imaginarywave.com/Clippings/CSS_extended.css.zip.asc http://www.imaginarywave.com/Clippings/SASS.sass.README http://www.imaginarywave.com/Clippings/SASS.sass.tar.bz2 http://www.imaginarywave.com/Clippings/SASS.sass.tar.bz2.asc http://www.imaginarywave.com/Clippings/SASS.sass.tar.gz http://www.imaginarywave.com/Clippings/SASS.sass.tar.gz.asc http://www.imaginarywave.com/Clippings/SASS.sass.zip http://www.imaginarywave.com/Clippings/SASS.sass.zip.asc Now if BareBones would only provide language support for HAML, SASS, RSpec, ... :) Matt
Leave a Comment


IdolHands.com Spam-o-MeterTM
Bot
Spammer
Moron
Human






* Required fields.