Back to BBEdit with a Unix Accent

February 28th, 2012  |  Published in mac and iphone  |  4 Comments

I have not been enjoying technology much lately, maybe because I’ve been enjoying it too much. It’s been one of those restless periods, but I think I’m coming out the other side.

In the past several months I’ve rediscovered Rails and Sinatra and added HAML & Bootstrap to my repertoire. Bootstrap gives me a lot of what I was getting with Blueprint, and some its markup is close to identical, so it’s been very simple to convert some smaller projects and quickly whip up pleasant front-ends for new ones. Combined with HAML, writing templates for Rails and Sinatra is a dream.

Two things I found that make writing HAML a little nicer:

Serve, a little rack app that “provides the equivalent of the Views part of the Rails MVC,” and can spit out a static version of your work if you just need a static site.

One small project I’m doing with Serve is a simple tech group status board. I can keep a set of maintenance and support events in a simple YAML file and read them in via Serve’s view helpers. I can keep the YAML file in my dock, update it as needed, and let a little Rake job handle pushing a static version of the status board out every so often.

LiveReload, which will watch a local filesystem and tell your browser to refresh when it detects changes.

This is going to sound incredibly lazy, but standing up a quick little Serve site, opening it in your browser, moving the browser over to a second monitor then watching changes to templates and content appear in the browser as they’re made (instead of needing to flip over to reload constantly) just feels liberating, especially if you’re still learning your way through the way some code works. It’s just “change, save, glance / change, save, glance / change, save, glance.”

But there’s also been discontent.

For starters, TextMate and I no longer see eye to eye. When I first started using it I was a Ruby novice and it did some things that made my life much easier. Its auto-indent helped me understand my own code better, I could run a Ruby script with a quick cmd-R, its bundles and snippets were much easier than Emacs and a bit easier than BBEdit. But it has never been a perfect match.

Between BBEdit, Emacs and TextMate, TextMate is by far the least robust. Large files bring it to a crawl and eventually crash it, which has always meant that I’ve had BBEdit laying around to step in when I’ve needed to work through a large file.

From a front-end Web developer’s point of view, I find BBEdit friendlier. The Markup menu is a nicer toolkit than what come with TextMate or Emacs out of the box, and the text filter palette makes more sense even if TextMate’s bundles are a little more keyboard-centric (which I prefer).

From a Rails developer’s point of view, TextMate is still more comfortable, but I’ve developed habits over the past several years that serve me in place of the Ruby-friendlier automation TextMate provides. The thing is, I’m not really a “Rails developer.” I periodically dive into Rails or Sinatra when I need to take a process I’ve automated for myself and hand it off to people who can put text into a web form but can’t run a shell script or learn to configure a text editor to run one for them.  Given nothing to do but Rails work, I’d be thrilled because Ruby’s my favorite language and Rails is very comfortable for me. But nine months into my new job, I’ve hit a few limits in terms of what I can automate for others and I need more efficiency (and HTML-centricity) for the things I can’t reliably hand off to people who aren’t as fluent in HTML as I am. BBEdit’s great when you need to automate text processing for yourself, not build tools to do it for other people.

All of which ignores Emacs. Whenever things start screwing up for me — TextMate crashes more times in a week than a developer’s tool should, for instance — I start eyeing Emacs again.

Emacs has been pretty good to me over the years. One could argue that I got a book contract because I knew how to make light of Emacs in a way that proved accessible both to people who knew what Emacs was to begin with and those who didn’t. It’s a sort of technological comfort food for me: Things go wrong and I go play with Emacs for a little while, tending to my .emacs file and making lists in org mode until I feel better.

So in the past few weeks, TextMate seeming to be twitchier than normal, I went back to Emacs for a bit, first with Aquamacs, then with plain old Emacs via Homebrew, which spits out a very nice Cocoa Emacs. But I’ve never really found Emacs comfortable for HTML editing, and that’s what I’ve needed more of. And I didn’t want elisp in between me and routine automation, much of which I’d be porting over from TextMate. I can get Emacs polished up for use pretty quickly, but it just didn’t feel very smooth and it wasn’t what I needed. I briefly cast about for a copy of an elisp manual at one point, until I remembered I had given it away during a moment where I realized it was just an aspirational bit of clutter I needed to be rid of. I don’t really want to be an elisp wizard, and I haven’t for a few years.

So I got to thinking about my rationalizations for returning to Emacs every so often, and they’re all good enough: It’s portable, so even if the Great Mac Meteor comes and renders OS X inoperable, even on ratty Hackintoshes, I’d have a familiar coding environment. It’s free, so there’re no upgrade fees for new releases. It’s robust. org-mode.

At the same time, things and people change. I’ve been using Macs pretty consistently for about ten years now. Even with Emacs keybindings wired into Cocoa I’m still more likely to use the standard set of Mac keyboard shortcuts these days. I prefer opening up a preferences pane to scanning a file full of configuration variables (and Emacs’ config buffer doesn’t count as a “preferences pane” even if it has been wired up to cmd-,). When I stick a Linux desktop on a VM and try it out in fullscreen mode for an hour, it no longer feels anything like home. It just feels like the product of people who are coming to grips with the fact that “be better than Windows” was a ridiculous goal, and who’re now trying to be better than a Mac (which is also ridiculous — just make something awesome unto itself).

So I fired up BBEdit for a day and it was a joy. Everything about it feels solid. It’s very configurable, so it’s easy to cut down on the proliferation of menu items and features. It respects the Unix heritage of OS X without being a slave to it. Most of the text filtering convenience scripts I’ve written in TextMate, for instance, could just be dropped into the support folder and bound to a key and used right away, because I wrote them as someone whose homeland is a Unix shell environment. Start with STDIN and go from there. So I ponied up to upgrade from version 9 to version 10.

But what about portability and all that? Good questions, never completely resolved when you’re using a tool that’s only available on one platform. At the same time, that one platform is my home and I plan to stay on it for a while. Sitting around worrying about the day it’s not going to be my home anymore isn’t any more productive than taking a course on current divorce law each year: If the giant Mac-eating star goat comes, I will be very sad for a little while, but I’ll just go back to Emacs and stay there. In the mean time, when I need to edit a remote file, I’ve probably got the server it’s on bookmarked in BBEdit.

 

Responses

  1. Ed Heil says:

    February 28th, 2012 at 7:03 pm (#)

    I’m still (probably foolishly) haunted by that Mac-eating star goat. Probably always will be. :(

  2. Rick Yentzer says:

    February 28th, 2012 at 8:22 pm (#)

    I’ve used BBEdit since version 6.5. I’ve checked out other editors over the years but I always felt more comfortable in BBEdit. However with Sublime Text 2, I’m starting to waver a bit, and it feels like I’m cheating on an old friend. ST2 seems to edit html better, it’s auto completion is great, and I like the matching pairs and bracket highlighting. BBEdits snippets are very nice, but I wish it behaved more like Textmates/ST2.

    I’d be interested in learning more about your unix scripts. I’ve dabbled in applescript to create a few handy text features but I’d rather not learn applescript when that is the only place I’d use it.

  3. mph says:

    February 28th, 2012 at 8:49 pm (#)

    Hey, Rick,

    BBEdit support for Unix scripting is pretty simple. BBEdit passes either the entire file or the selection to a given script as STDIN and replaces the selection with STDOUT, so drop something like this into ~/Application Support/BBEdit/Text Filters:

    #!/usr/bin/ruby
    text = STDIN.read
    text.upcase!
    puts text
    

    it will show up in the Text Filters palette where you can either click it to invoke it or bind it to a key. A more elaborate case: I dropped the Ruby beautify script into that folder and bound it to cmd-B, which quickly reindents my code. I also have simple filter scripts to do stuff like pass bad HTML through Ruby’s sanitize gem or apply a standard set of inline styling for HTML newsletters.

  4. mph says:

    February 28th, 2012 at 8:52 pm (#)

    Oh … also meant to say that BBEdit 6.5 is when I first used it, too. I remember buying it not long after I enrolled in some classes at a local university so I could get it on the student discount. If nothing else, TextMate probably helped get BBEdit down to a more consistently reasonable price.

Leave a Response

© Michael Hall, licensed under a Creative Commons Attribution-ShareAlike 3.0 United States license.