BBEdit 14, and why you should care
When TextMate burst onto the scene in the mid-2000s, it didn’t take aim at Emacs and Vim as much as BBEdit, a Mac-only editor around more than a decade at that point. TextMate offered radically easy ways to create sophisticated new language modules and plugins compared to most editors of the day. Mostly, though, TextMate had Ruby on Rails: David Heinemeier Hansson developed the framework with early versions of the editor, making it almost custom-built for Rails. That gave TextMate a boost working with other server-side frameworks.
Since then, cross-platform editors and IDEs like Microsoft’s Visual Studio Code and JetBrains IDEs have come to dominate the coding world. This is an issue for those of us who want Mac-assed Mac apps. I hung onto TextMate and then the native-but-weird Sublime Text, shifting to Code somewhat reluctantly. Last year, I pounced onto Panic’s new Nova, reviewing it positively shortly after release.
BBEdit is obviously a Mac-assed Mac app, and for reasons I’ll return to, I came back to it years ago for technical writing—but not for coding. (It sometimes seems like BBEdit’s biggest fans are writers.) Some more code-focused users, though, haven’t looked at it in years. With the release of version 14, should they reconsider?
Musty, or battle-tested?
Few editors have been around longer than BBEdit—and few have been as rock-solid. I don’t think I’ve ever lost work. It can even “rescue” never-saved documents you mistakenly close without saving!
Yet, that venerable age has become a double-edged sword. “Looks old” is a dismissal I’ve heard a lot. I’ll be honest: to me, it looks like…a text editor.
It’s information dense, but neither overly busy nor packed with unnecessary bits. (Nearly everything shown here can be turned off, too.) One thing you don’t see? Tabs. Instead, there’s an open documents list in the sidebar. If you end up with a dozen or more files open at once, this approach starts really showing its advantage.
Leaping forward
Here’s something cool:
This editor understands PHP well enough to know that after you type $handler->
, it should offer methods from the Handler
class as autocomplete options, because it knows $handler
is an instance of that class.
This level of introspection used to be the exclusive domain of IDEs, but a couple of years ago, Microsoft introduced the Language Server Protocol for Code, so plugins could offer this functionality. Nova supports LSP natively, and with version 14, so does BBEdit: it’s what that screenshot is from. In addition to smart autocompletion, BBEdit uses language servers for:
- Function parameter help
- Real-time code linting
- Navigating to function definitions and symbol declarations
- Reformatting documents
See the green dot in that screenshot? It’s a dropdown for showing errors and warnings in a file. Individual lines also get their line numbers highlighted and the issues shown by underlines. (The snippet above shows $response
with a red underline in two occurrences: the first because that line isn’t complete and so has a syntax error on it; the second because, thanks to the first error, $response
isn’t defined yet.)
BBEdit is preconfigured to use many language servers, like Intelephense, out of the box once they’re installed. This can be considerably more complicated in other editors, especially if their LSP support is itself provided by an extension.
A couple of caveats: first, a lot of language servers apparently haven’t been tested with anything but Code, and can get quirky with any other editor. Sometimes BBEdit can work around quirks, but not always. Second, BBEdit doesn’t support all LSP features. For instance, documentation won’t pop up when you hover your pointer over a function or symbol. (Although some might consider that a feature.)
Other new features
BBEdit 14 now has a “Notebook.” This takes the already-existing “scratchpad” feature (itself unique to BBEdit) a step farther, storing multiple notes as individual sheets within an always-available Notebook window. By default, BBEdit creates notes as Markdown files, but you can change them to other languages. As with any text file, you can create new notes from the clipboard or from selected text, by dragging text, or even from the shell by piping text to bbedit --note
.
I haven’t played with the Notebook much yet. It strikes me as the kind of feature you’re either going to rarely use or use all the time, and it’s not clear to me where I’ll fall. I use scratchpads a lot, though, and have a weakness for note-taking apps. I could imagine putting together a package that offered some basic to-do list functionality that might effectively replace TaskPaper, too. It’s not Emacs’s legendary Org mode, but then again, it doesn’t make you learn Emacs.
Beyond that, BBEdit now supports Emmet for HTML and CSS expansion if you install the Node Emmet module; if you make from-scratch HTML pages a lot, this is a big deal. If you’re a Python programmer, BBEdit is now aware of Anaconda/Conda virtual environments out of the box, and lets you switch between them with its shell menu.
Other old features
When I became a full-time technical writer in 2014, I tried a few different editors and settled on BBEdit, even though its Markdown syntax highlighting is…spartan. Why? Because BBEdit is a Swiss Army knife, a Leatherman multi-tool, for text processing. In no particular order, here’s some interesting things BBEdit does that I rarely see in other editors.
- What it lacks in Markdown highlighting, it makes up for in Markdown previewing. You can set custom HTML templates, CSS files, and even processing scripts. (You can do this for HTML files, too, and I suspect for other kinds of plain text markup languages.)
- Many editors have a “fuzzy file open” feature, but BBEdit can open multiple matching files simultaneously. I use this way more often than you might think.
- BBEdit keeps a history of find/replace searches, and lets you save complex grep patterns with names for easy recall. And you have to see its “Multi-File Find” feature to fully appreciate how great it is.
- You can build a “text factory” of multiple actions; it’s like having a simple version of Shortcuts or Automator built right into the editor. You can save them as text filters or use them for batch processing. I have a simple-minded Markdown to BBCode conversion “script” I created this way without writing a line of actual shell script.
- You can “process” lines in a file, searching for duplicates or lines that match specific patterns (including regular expressions), and delete those lines, copy them to the clipboard, or create a new document with them.
- BBEdit can operate on “columns” of tab-separated values, cutting, copying, pasting, and even rearranging them.
- While Git support is mostly (ahem) bare bones, it’s fantastic with file-specific commands like diffs and revision history.
- The “Pattern Playground” is outstanding for constructing complicated regular expressions that work with your documents.
- BBEdit uses Kapeli’s Dash documentation browser if it’s installed.
The Unix Worksheet in BBEdit deserves its own paragraph. Send any line in the worksheet to your shell by tapping Control-Enter, and the output from the shell appears under that line in the worksheet. You can’t run interactive shell programs this way, but for most commands you now have an editable, modifiable history. In my technical writing, I create lots of local branches; I usually use a worksheet to clean them up by running git branch
to get a list of them, then adding git branch -d
before each one I no longer need. The worksheet is inspired by the long-defunct MPW, but Emacs fans might consider it a cousin of shell mode.
Lastly, another feature of BBEdit worth checking out: the 400-page user manual. Yes, that is what a technical writer would say, but it’s a remarkable boon.
A few missing features
BBEdit has a more “batteries included” approach than most editors, and so needs fewer third-party extensions. But, the integrated managers in Code and Nova make a strong argument for a centralized package index. Sublime Text’s Package Control started as a third-party system, so it’d be possible for someone else to take up the mantle here. The closest BBEdit has is BBEdit Extras, and while it has some good stuff, it’s also got outdated (and frustratingly undated!) stuff and link rot.
Sublime Text popularized multiple cursors in text editors. BBEdit’s processing commands can do nearly anything these can—honest—but if you’re a multi-cursor junkie, it’ll be an adjustment.
Codeless language modules only set colors for strings, comments, keywords and “predefined names,” along with delineating functions for navigation and folding. CLMs also can’t be used for templating systems like Jinja or EEx that exist as “embedded languages” in HTML. You can write a more powerful language definition in Objective-C—I presume including templating languages, since “PHP in HTML” and “Ruby in HTML” are standard—but that’s a hella big ask.
Back to the future
I’ve long believed that BBEdit’s balance of text processing power with discoverability and ease of use makes it the best tool for “documentation as code”-style technical writing on the market. But at least for me, it hadn’t kept up with the state of the art for coding. With BBEdit 14, this no longer feels true.
So, I’m moving back. I’ve created a new color scheme, SpaceBones, inspired by the default color scheme of Spacemacs. I’ve been working on an up-to-date package for Elixir that comes with an LSP, as well as creating a new set of clippings for PHP 8. My old Editor Actions package may get a reboot. Hopefully, there will be ways to publicize these; I’d love to see a BBEdit-focused project similar to Vim Awesome.
If you’re already a BBEdit user, version 14 is an essential update. If you’re not—whether you used it years ago but drifted away, or never used it at all—it’s time to give it another look.
BBEdit 14 is $49 new from Bare Bones Software, with upgrade discounts for owners of earlier versions, or from the Mac App Store with a $39/yr annual subscription. You can use BBEdit for free with a more limited feature set. Disclosure: I beta-tested BBEdit 14, and received a free upgrade serial code.
© 2021 Watts Martin · License: CC BY-NC-SA 4.0