On the Mac it's called TextExpander. Several Windows utilities that do the same thing can also be found.
In short, TextExpander does what the name implies, it's a system-level ulitity that keeps an eye on the text you type and, when it sees a predefined sequence it recognizes, it expands it.
Perhaps an example is in order. When I'm coding I've found that one function I'm typing constantly is structKeyExists. Now comes TextExpander. Whenever I type skex (mental mnemonic: struct key exists eXpand), it replaces those four letters with "structKeyExists()", with the cursor inside the parens ready for me to continue on.
Nothing new really, and you can do it with snippets. But how MANY of them can you do and remember?
Typing skeax gives me structKeyExists(arguments,''), while sketx gives structKeyExists(this,''). (Added an A and T to the sequence, respectively.)
Or typing cffux gives me a standard cfunction with argument and script block:
<cffunction name="get" public="yes" output="no" returnType="void"> <cfargument name="name" type="string"> <cfscript> </cfscript> </cffunction>
Do a slight alteration, and cffugx gives me a "get" function with return code, while cffusx is a typical "set" function.
My mental mnemonic is to use the first four letters of the tag or function, followed by "x" to expand it. I may add a character if I have several versions of the same type, like the get/set function example above. Given that, you can perhaps figure out, even without being told, what cfswx, cflox, cfinx, cfoux, cfouqx, or even creax do.
Here's cfswx:
<cfswitch expression="##"> <cfcase value="xxx"> </cfcase> <cfdefaultcase> </cfdefaultcase> </cfswitch>
The others were cfloop (with from, to, and index already inserted), cfinclude (wth template), cfoutput, and cfoutput (with query), and createObject('component','').
In other words, TextExpander is like snippets on steroids, or a super AutoComplete that lets you "speed-type" your most commonly needed tags and functions, with the arguments and defaults that you need and use already inserted, prepped and ready to go.
How many "boilerplate" functions do you type constantly? How many functions? Tags? How often do you mentally sigh every time you need a cfswitch or cftry, knowing you're also going to have to type the case and catch statements before you can get on with it? TextExpander could be the answer.
And with the multi-key sequences, you can easily remember and associate hundreds of the silly things. Try that with command-alt-shift-F6.
It can also be used for more pedestrian applications, like expanding 303x to expand your phone number in Mail, or 1829x to expand your address in Word. One company I turned on to it uses it for common help desk boilerplate, inserting the explanations needed recovering a password or downloading and printing a PDF.
It's a great utility. And honestly, one that you shouldn't have to buy. This type of thing has been built into text editors and word processors for years. It's a highly productive tool that SHOULD have been built into Dreamweaver. And wasn't.
Instead we we get to drag and drop CSS rules between documents and style sheets. Go figure.
Oh, yeah. TextExpander is available from Smile On My Mac for $30. Well worth it.
Why not just use CFEclipse which has built snippets that already work exactly the way you want? And it's free.
Posted by: Sean Corfield | June 26, 2007 at 08:47 AM
Could, but for better or worse I'm used to Dreamweaver and, as I said in the article, TextExpander works systemwide, and as such isn't limited to Dreamweaver or, as you suggest, CFEclipse.
Posted by: Michael Long | June 27, 2007 at 03:47 AM
If you're looking for a Windows equivalent, or want to use your existing TextExpander snippets on Windows, I wrote Breevy (you click my name or Google it for more info).
Text expanders *are* definitely useful for coding, though.
Posted by: Patrick | March 19, 2010 at 12:16 PM