oreilly.comSafari Books Online.Conferences.


AddThis Social Bookmark Button

Text Tricks and More Text Tricks

by Giles Turnbull

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.

Split Your Text Windows

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.

View Text in Columns

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.

Text to HTML

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).

Interlude: A Tip from Matt Biddulph

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.

Matt said:

"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."

TextMate Tricks

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.

TextMate, a power editor
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.

Pages: 1, 2

Next Pagearrow