Text Tricks and More Text Tricks
Pages: 1, 2
Send Text To...
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.
Interlude: A Tip from Merlin Mann
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."
BBEdit Tricks
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.
Mess Around with DevonThink from the Command Line
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.
Edit Text Better in Browser Form Fields

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.
Interlude: A Tip from Glenn Fleishman
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
^\s*([^\t]+).*\nreplace with : $1
and then
^(.*)(\S+$)replace with: $2, $1 "
Extra Text Toys
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.
You must be logged in to the O'Reilly Network to post a talkback.
Showing messages 1 through 21 of 21.
-
You missed my fun article about the Cocoa Text System, Giles
2006-11-16 15:07:34 jacobolus [Reply | View]
-
Block Edit in SubEthaEdit
2006-10-15 07:27:50 nwfrg [Reply | View]
You can edit multiple lines at once by holding ? (option) and selecting an area. Click inside and edit. To stop blockedit press ? (escape) or click outside the highlighted area. Since SubEthaEdit 2.1 you can also press shift-command-B to blockedit the current selection.
Demo movie of this at:
http://www.codingmonkeys.de/subethaedit/goodies/blockedit.mov
-
Colour replacement text
2006-10-13 11:22:56 mirazjordan [Reply | View]
In Tex-Edit Plus you can choose a colour for the replacement text in a Find and Replace operation. I use this all the time to instantly see the results of my F&R - especially when GREP's involved.
I really really miss this feature in BBEdit.
-
more tips
2006-10-13 07:24:09 sootmann [Reply | View]
pbcopy and pbpaste deserve a lot more attention. they're near and dear to my heart--when I started out using Linux, one of the things I wanted, but never got, was a way to get STDOUT into the clipboard. OS X delivers.
pbcopy accepts standard input and pbpaste creates standard output. so, you can `ls | pbcopy` to put the output of 'ls' into the clipboard, or you can `pbpaste > file.txt` to create a new text file with whatever's in the clipboard. Note that there are some Mac/Unix cr/lf/newline issues. If what's being pasted came from the GUI, it probably has Mac line breaks, not Unix newlines. I have a script that uses pbcopy and pbpaste and it has these lines:
# step 1: paste clipboard contents into a temp file
pbpaste > ~/temp1.txt
# convert mac returns to unix newlines
# put newly formatted contents into another temp file
tr '\r' '\n' < ~/temp1.txt > ~/temp2.txt
Also, BBEdit and TextWrangler (and probably others) allow rectangular selections. If you've got a lot of lines like
ABCDEFGH
ABCDEFGH
ABCDEFGH
and you want to remove all the DE's, you can press the option key, then click and drag a rectangle around all the DE's, then press 'delete' once and poof! they're gone.
-
need vertical split
2006-10-12 16:33:21 shortstop [Reply | View]
I want a GUI-based text editor that allows me to do a vertical split. Lots of them do horizontal split but none do vertical split. I want to be able to look at source in one file, and edit the same file in another spot.
BBEdit almost does this, they have that synchro-scroll thing, but you can't have 2 views of the same file.
JEdit does vertical split, but doesn't have a C-Language function popup that I could find. If it does have one, it is not documented well enough for me to figure out how to use it.
Smultron and XCode only do horizontal splits. TextMate doesn't split at all AFAICT.
Does anyone know of anything with a vertical split and a C-language function popup support?
-
Read Aloud from Cursor Point
2006-10-12 08:26:42 Inkling [Reply | View]
Unless I've missed it, none of the text editors mentioned here do something I consider a must--the ability to begin reading a text aloud from the cursor point. Only the venerable Tex-Edit Plus does that, which is why I've stuck with it rather than move to the prettier face of TextMate.
Lots of application will start reading from the beginning of a document or read a highlighted block, probably because OS X makes programming that easy. But for spotting typos in a text or for comparing an electronic copy to the original printed version (including code in a book), reading aloud from the cursor point on it a must.
That's the first feature I check when I download a new text editor, and up to now I've been disappointed.
-
wow, that just got mangled
2006-10-12 08:11:11 piers.hollott [Reply | View]
It looks like some of that post didn't get escaped properly... what I meant to say was, quickly comment out a line in JEdit by typing "< - -" at the beginning of the line, then, after the autocomplete window comes up, reposition your cursor, and hit space to close the comment... sheesh!
-
"commenting out" with JEdit
2006-10-12 08:05:53 piers.hollott [Reply | View]
I don't think this is a supported feature, but I use it all the time... to comment out a line of html or xml (jedit on a mac), you can type " JEG2 [Reply | View]
For those of you who are TextMate fans and those of you who would like to learn more, the TextMate book from the Pragmatic Programmers is now in beta:
http://www.pragmaticprogrammer.com/titles/textmate/index.html
There are a couple of excerpts at that link, if you want to check out what's inside.
It covers tons of tricks similar to those mentioned in this article, from the TextMate point of view. It also has quite a bit of information on lesser known and undocumented features. Should be something for just about every level of text ninja in there.
James Edward Gray II
-
Editing text areas in a browser
2006-10-11 01:38:36 Melo [Reply | View]
For those using Safari and TextMate, you can install a Input Manager extension that comes with TextMate called "Edit in Textmate" that will allow you to edit any Coocoa text input, including Safari text areas.
To install, in TextMate, Bundles > TextMate > Install Edit in Textmate
I believe you have to logout/login to see it, but I'm not sure.
Best regards,
-
Customizing the Cocoa Text System
2006-10-11 01:12:18 otto [Reply | View]
For those of you who want to customize the Cocoa Text System without TextExtras, this article provides a great summary:
http://www.hcs.harvard.edu/~jrus/Site/Cocoa%20Text%20System.html
I've successfully replaced my TextPander shortcuts with keybindings.
-
Markdown and central european languages
2006-10-11 00:32:12 Kelt [Reply | View]
Humane Text service cannot cope with the accented characters of some central european languages. But with some creative applescripting - for example modifying Matt Wilson's SubEthaEdit preview script (http://problemattic.net/blog/2006/01/09/subethaedit-markdown-preview/) - one can get a decent converter in his favourite editor.
-
Inaccurate info
2006-10-10 16:32:09 Vocaro [Reply | View]
you can split a Smultron window and display a different file in each split, something no other editor offers
Incorrect. Apparently you have never tried jEdit.
-
Inaccurate info
2006-10-10 19:33:22 NickLo [Reply | View]
...or Vim, which has had split windows for a long time. -
Inaccurate info
2006-10-11 08:44:36 cmc [Reply | View]
...or Emacs, which lets you split them vertically or horizontally (and even both at the same time, if you swing that way). -
Inaccurate info
2006-10-11 01:17:59 Giles Turnbull |
[Reply | View]
My error, thanks for your corrections.
-
Editing text areas in a browser






If you're a text tricks geek, I think you'd enjoy my Cocoa Text System article:
http://www.hcs.harvard.edu/~jrus/site/cocoa-text.html