Here’s a bit of a BBEdit hack for a very specific problem. There are a number of words I either confuse or overuse when I write hastily. I’m not talking about misspelling of words, but rather using one word in the place of another. For example, using “peak” when I meant “pique” or “your” when I meant “you’re”. I wanted a custom grammar checker to let me know when I might have a problem with a document. After some reading and tinkering I came upon a use of BBEdit for proofreading that involves a codeless language module.
I don’t really want or need a full-blown grammar checker. Just look at the grammar tools built into most word processors. They’re made for high school creative writing and they are far too verbose to be of much use. What I needed was a highly customized grammar checker tailored to my specific weaknesses. I also wanted the ability to add to the rules as I identify additional weaknesses.
Codeless Language Modules
BBEdit is highly customizable. If someone is willing to download and learn the SDK, there’s almost no limit to what can be done with it. But there’s also a no-code method of defining a custom language format. This really got my interest so I did some reading about the “CLM” and came up with my own plist file to define my “language”. My goal was to have BBEdit highlight my problem words. Some words I overuse or use improperly.
The plist file can be downloaded here.
It’s pretty basic. It is made up of a bunch of keywords for BBEdit to highlight. It also defines a pretty inclusive Identifier and Keyword Character Class so that commas and apostrophes can be included in the keywords.
Once this is defined, the plist file is placed in the ~/Library/Application Support/BBEdit/Language Modules/ folder and BBEdit is restarted. Now I have an additional language I can use for editing. I also wanted to use a color scheme that would really stand out when i am reviewing. Solarized is one of the best. So I downloaded and installed the BBEdit color scheme from the solarized site and associated it with my new language. I also changed the function highlight color slightly so that it would be a bit more obvious. I think the results are quite fetching.
The custom color file for BBEdit can be downloaded here.
Like any useful text editor, BBEdit also has a search tool. Unlike most editors though, there is an option to use grep regular expressions rather than simple substring matching. Furthermore, the BBEdit search is more than the typical “Find Next” functionality. It’s a document review system.
Bringing up the BBEdit “Find” window provides several options for entering a regex for grep searching. I hacked together one that looks for some misused words as well as miss uses of “a” and “an” which is something I do often. The regex can then be saved as a custom pattern and recalled from a shortcut.
After executing the search, BBEdit displays a review window. Stepping through the review, selectively highlights the matched substrings.
It seems like a lot of hacking around, but once I understood a bit more about BBEdit, it was actually very easy. The BBEdit documentation isn’t very good for this stuff, so web searches were crucial to figuring it out. Now I know a bit more about my text editor too. This is an early experiment so I’ll see how it goes. It seems to fit in my workflow. I use plaintext. I use BBEdit. I make a lot of mistakes.
Update: After reading the BBEdit documentation a bit more extensively, I have to admit that I was wrong. This functionality is quite well documented in version 10.1. RTFM!
<li id="fn:1">This is a specific case where TextExpander just doesn’t help me. The words are correctly spelled, they just exist in the wrong context. Maybe TextEpander v.20 will understand context. <a class="reversefootnote" title="return to article" href="#fnref:1"> ↩</a></li>