Text Accordians

I write, with my keyboard, all day. Every day. E-mails, lecture notes, grant applications, status updates, first drafts, second drafts, slideshow bullets, blog posts. To paraphrase the great Johnny Cash, I type everywhere, man.

And along the way, I find I quite often need to write the same words and numbers. I close every e-mail the same jaunty way (“yours, Michael”); I give students the same directions to my office; I repeat the same writing advice in my grading; my phone number hasn’t changed in a decade.


One day someone in my department mentioned a tool that saved time with these repeated snippets, called TextExpander. It runs in the background, and watches what I’m typing. Whenever I type an abbreviation, TextExpander replaces it with the text that I’ve set it to. For example, when I type :mu it replaces that with Michael Ullyot – which, unsurprisingly, I type often. When a student requests a reference letter, I reply with :rf to send them a list of what I need. And so on. My abbreviations all start with a : so I don’t trigger them when I’m typing normally, when I wouldn’t type a : without a space after it.

I also use some of TextExpander’s fancy features, beyond these copy-paste tricks. If I want today’s date, I type :da and get 16 February 2018; or yesterday’s (:dy > 2018–02–15); or next Friday’s (:nf > 23 February). Those dates are in different formats, because I set them that way.

In the last 7 years, as of 2018–02–16 (see how I did that?) I’ve expanded 34,009 snippets, which saved me from typing 754,990 characters, which would have taken me 31.46 hours of my life.

But this post isn’t (just) my enthusiastic product review. There’s something I’ve been meaning to add to my TextExpanding skillz, and today I finally did it: transforming texts on the clipboard, using Javascript. Wait: before you stop reading, hear me out.

If you’ve ever had to retype something in upper case, or to sort a list alphabetically, or to underline a word or a line for emphasis, you shouldn’t. Computers are really good at simple transformations, and your time is better spent on higher-level work.

Take the opening lines of my favourite Johnny Cash song again, “I’ve Been Everywhere. I’ll copy these four lines to my clipboard:

I’ve been everywhere, man
I’ve been everywhere, man
Crossed the deserts bare, man
I’ve breathed the mountain air, man

Then I just type :jcu and get this:

I’VE BEEN EVERYWHERE, MAN
I’VE BEEN EVERYWHERE, MAN
CROSSED THE DESERTS BARE, MAN
I’VE BREATHED THE MOUNTAIN AIR, MAN

Or :jcl for lower-case:

i’ve been everywhere, man
i’ve been everywhere, man
crossed the deserts bare, man
i’ve breathed the mountain air, man

Or :jct for title-case:

I’ve Been Everywhere, Man
I’ve Been Everywhere, Man
Crossed The Deserts Bare, Man
I’ve Breathed The Mountain Air, Man

Which is great, if I need to do short text-transformations. There’s another to double-space between sentences, and you can do whole paragraphs in an instant. I won’t demonstrate it here, but I’ll show you two more tricks.

Say I need to alphabetize a list, like this one of the first few places Johnny’s been:

Reno
Chicago
Fargo
Minnesota
Buffalo
Toronto
Winslow
Sarasota

Type :jas and hey presto, they’re alphabetized:

Buffalo
Chicago
Fargo
Minnesota
Reno
Sarasota
Toronto
Winslow

Or :jar for the reverse order:

Winslow
Toronto
Sarasota
Reno
Minnesota
Fargo
Chicago
Buffalo

Finally, what if I want to underline a sentence? Take this example:

I’ve been everywhere, man

Copy it to my clipboard, and type :jul~ to get this:

I’ve been everywhere, man
~~~~~~~~~~~~~~~~~~~~~~~~~

Or type :jul+ to get this:

I’ve been everywhere, man
+++++++++++++++++++++++++

You get the picture. TextExpander takes what’s on the clipboard, changes the text, and pastes the output. Or it checks the system calendar and outputs the date of next Friday, or next week, or yesterday. If you’re doing these calculations and transformations yourself, or even if you’re just constantly typing the same texts yourself, stop it.

To close, a credit roll. I didn’t write these Javascripts myself; they’re from Thought Asylum. The suggestion to try TextExpander (for grading) came originally from Harry Vandervlist, my colleague in the Department of English at the University of Calgary. And finally, spend some of your newfound free time watching this Google Map animation of Johnny Cash’s travels chronicled in the song. Happy trails.

Leave a Reply