Do you know what my biggest pet peeve in OS X has been? It’s that it’s too smart for it’s own good.
Let me be more specific: when you copy something to the clipboard, it almost always holds the rich text formatting of the app you copied it from. If you paste it into another rich text app, you end up with something that looks like this:
This, undeniably, sucks. Yes, there are a few times where you want the format to copy, but this is rarely the case with most apps. I’d say maybe 5% of the time this is useful, and 95% of the time it makes me want to snap my MacBook Pro in half.
My solution to date has always been “copy from source app, paste into TextMate, copy back out of TextMate, paste into target”. I love TextMate, but this is needless abuse of a lovely app.
Was talking to Mikey (he of Think) this morning, and he explained the issue thusly:
>”It’s a side effect of copying rich text to the pasteboard server. The app copying it doesn’t know you’re going to take it to another app, and the other app doesn’t know where it came from – just that it’s on the pb.”
And then he threw out his solution to the problem:
$ pbpaste | pbcopy
And I thought, “well, I could alias that I guess, but then I’ve gotta keep jumping into terminal and typing. And I really want a hotkey for this. You know, like a QS trig…”
So, friends, if you too are affected by the horribly crippling brilliance of OS X’s rich text pasteboard, simply make the trigger shown at right. If you don’t know how to do this:
- Invoke QS.
- Type Command-‘ (that’s a single quote) to go to the Trigger preferences.
- Create a new trigger by clicking the + button.
- When the trigger pane drops down, press the period key to enter text mode.
- Type “pbpaste | pbcopy” into the text field. (Or, for the slightly meta, you can copy and paste it from this post.)
- Press tab – select “Run Command in Shell” as the action if it’s not already selected.
- Save the trigger and then assign a hotkey as normal.
I bound mine to Shift-Option-Command-V, since I’ll tend to hit it right before I paste something out. You can choose whatever you find most comfortable. In case it’s not clear, this takes the contents of your clipboard and pastes them right back into the clipboard. Because this is being run as a shell command, the formatting falls right off.
If you’re entirely unfamiliar with triggers, you might be in need of a read of my trigger tutorial.
Thanks again to Mikey for his help in turning the lightbulb on over my head.
FIRST EDIT: I’ve been reminded (thanks, Suw!) that you need to have the Terminal Plugin installed to have access to the Run Command In Shell action. Also, note that this trigger does not paste for you; it merely strips off formatting while still in the clipboard.