We've covered text editors here before. We know, from various posts at the Mac DevCenter blog, that our readers are often as fanatical about using plain text as we are.
Tips on using your editor of choice are easy to find, but we thought it would be fun to gather a whole bunch of them together for the first time; not only to spread the word, but to invite our readers to add their own tips and time-savers. We've also asked a handful of Mac users to contribute their own favorite text tricks.
You have probably encountered some of these already, but we hope there's a few gems that are new to you.
Without further ado, let's dive in.
BBEdit's window-splitter is hard to spot. The little gray box at the top of the scroll bar on the right is what you need: drag it downward to split your window. But Smultron 2.0 offers something a little better; you can split a Smultron window and display a different file in each split, something no other editor offers.
Tofu is a very handy utility to have around. It grabs almost any text you care to throw at it and reformats it into an easy-to-read column view like you'd see in a newspaper. Great for long dull documents or plain text ebooks downloaded from Project Gutenberg.
When writing your own HTML is a pain, there are various ways of making the chore a little less tiresome.
John Gruber's Markdown is among my favorite tools of all time. Described as "a text-to-HTML conversion tool for web writers," it turns suitably formatted text into valid (X)HTML. This article (and almost everything else I write for the web these days) was written using Markdown in BBEdit.
To use it the same way, download Markdown and put it in ~/Library/Application Support/BBEdit/Unix Support/Unix Filters. It should show up in your Unix Filters menu, and you can assign a keyboard shortcut to it in the Unix Filters palette.
One of the best features of Markdown is that it's designed to be readable even in an unconverted state. In other words, the plain text original should be almost as easy to read as the HTML alternative.
There are many other ways to use it--directly in your Movable Type installation, for example--or by applying the HumaneText service to any Markdown-formatted text. HumaneText offers more convenience because, as a Services menu item, it'll work in Services-compliant apps (i.e., most of them).
Matt Biddulph edits in vim, but his chosen trick is a little utility called pbcopy. He wasn't the only one to sing its praises; several of our interviewees mentioned it and described how it'd be hard to live without it.
"I use pbcopy all the time to get stuff out of commands and text files and into text editors and forms via the clipboard.
"For example, when I'm editing scripting code for Second Life, I like to do it in vim, my editor of choice. Second Life isn't currently able to call an external editor, but it does support cut and paste in its editing interface. When I'm done editing code, I type:
which pipes the current document through the pbcopy command which places it on the clipboard. Then I jump into SL and hit Apple-V."
Garrett Dimon, like a lot of other people, has enjoyed using TextMate for coding (see Figure 1). TextMate is popular for many reasons, not least of which is the broad and easy-to-expand (thanks to the Bundle system) feature set. That said, there's still a learning curve to get over, and even regular users might find themselves missing out on useful features.
Figure 1. TextMate, a power editor
Garrett took the time to document some of his favorites, including the super-useful Control+Shift+W that wraps selected text in paragraph tags but lets you edit the tags immediately, offering a lot more control. Garrett has more about snippets in TextMate on his website.
Alex Young's TextMate review at Vitamin highlights another popular feature, that of using alt-drag to highlight blocks or columns of text. Duane Johnson came up with a way of implementing multiple arbitrary simultaneous carets.
TextMate can also be used as an external editor for Mail, or as a means of staying organized. Someone's even made a cheat sheet for Ruby on Rails developers.
Want to read something on your Palm? Use PalmDocCoverter to change it to Palm-ready text.
Thanks to the 2sms.com widget, you can send SMS text messages to mobile phones straight from your desktop.
Devon TechnologiesBlue Service throws text snippets around your Bluetooth network, making it easy to send something to a phone or PDA with Bluetooth smarts.
Merlin Mann, of 43 Folders fame and well-known for his addiction to plain text, sent us this great tip about TextExpander.
"TextExpander stores strings of text (or images) and pastes them behind your cursor position based on abbreviations and conditional triggers that you choose.
So, for example, you could set it so that whenever you type "
LOL", TextExpander will spit out "That remark you just made is, in my estimation, humorous." Or, maybe next time that you IM a cool new website to A-List blogger Anil Dash, and he says "Seen it," you can just type, "
sorryanil" and TE will automatically produce "Sorry, Anil, I didn't know you'd seen this link already. I'll let you get back to work." Time saved all around! Signatures, links to Goatse, or even entire form letter responses--it's all possible, so let your imagination run wild.
To make best use of TextExpander, it helps to start watching for the items that you find yourself repeatedly typing (or mis-typing). TextExpander makes the rapid creation of new abbreviations really easy via the OS X "Services" menu. Just type the full (correct and expanded) text that you want to reuse, then highlight it, and select "
[Application you're in] > Services > TextExpander > Create Snippet". This opens up the TextExpander PreferencePane with your desired text added as a new entry, so all you need to do is type the desired abbreviation or triggering text. Fast and easy."
O'Reilly contributor Kevin O'Malley wrote about BBEdit's Unix support back in 2004. That article is an oldie, but a goodie.
Like young upstart competitor TextMate, BBEdit's expandability is one of its most appealing features. Hence add-ons like Todd Ditchendorf's XSLPalette, a set of XSL debugging tools in one handy panel. Or Michael Tsai's Character-level diff, or Joe Brandt's XML tools.
Jan Erik Mostrom wrote a useful little Python script for previewing Markdown-formatted text directly in BBEdit. Entable is a great plug-in for BBEdit or it's little cousin TextWrangler; it does a superb job of turning rough columns of data into nicely presented ASCII tables.
Thanks to John Gruber and AppleScript, you can even implement a Select Word feature if you feel you need one.
DevonThink is a powerful and popular information manager and digital archive application for OS X. Some of these scripts from Eric Fedel might come in handy for advanced messing with your DevonThink databases. They're a mixture of shell and AppleScripts, and are released under a BSD license.
Figure 2. OmniWeb external edit
One of the best things about OmniWeb is that it deals with forms a lot better than most browsers. Every text box has a little control that, when clicked, opens a mini editor within OmniWeb (see Figure 2). It's pretty limited as editors goes, but it's nicer to use than a box embedded in a web page. One day all browsers will have a preference setting to allow your choice of external editor. For the time being, External Editor does the job as an extension in Firefox.
Writer and author Glenn Fleishman offered this snippet of regexp wisdom:
"I'm a long-time grepper and have learned how to use regexp features in most of the software I regularly use. I prefer BBEdit for its robust grep and related search-and-replace features, and when I'm working with text, I immediately go to BBEdit.
I often encounter lists that I'm trying to stick into a database, and thus regexp becomes my friend. For instance, it's very frequent to find something like
[space][space][space]Richard W. Wellperson[tab]234 W. Street[tab]West Futhersold[tab]W.V.[return]
But all you need is the person's name in last, first order. I'll write my little regexp to do
replace with : $1
replace with: $2, $1 "
Figure 3. A quick dictionary
In Cocoa text apps like TextEdit, hitting Option+Escape when you're half way through a word will pull up a list of likely correct spellings for you to choose from. There's no faster way of accessing the built-in dictionary (see Figure 3).
Mike Ferris' TextExtras adds more features in any Cocoa text editing environments (including TextEdit windows or Safari text boxes). I have found it handy for spotting rogue non-ASCII characters in documents.
Michael McCracken's Incremental search plug-in adds very convenient searching to TextEdit and other apps based on NSTextView.
Drag a folder full of files on to Folderlister and it will helpfully spit out a plain text listing of the contents.
Write in blissful isolation with Hog Bay's Writeroom (see Figure 4).
Figure 4. Writeroom writing (click for full-size image)
Using Text2MP3 you can turn your texts into lovely audio files perfect for playing on an iPod.
Split and join files into sizes that make sense for you, with Split+Join.
We've barely scratched the surface here. If you have a particular favorite text trick, plug-in, or hack, please share it with the rest of us via the comments.
Giles Turnbull is a freelance writer and editor. He has been writing on and about the Internet since 1997. He has a web site at http://gilest.org.
Return to the Mac DevCenter.
Copyright © 2009 O'Reilly Media, Inc.