Quicksilver Trick: Strip Clipboard Formatting

It’s been a while since I did a Quicksilver one-off, but with all the [recent](http://lifehacker.com/software/quicksilver/hack-attack-a-beginners-guide-to-quicksilver-247129.php) [crazy](http://www.43folders.com/2007/03/05/tms-comma-trick/) [hype](http://www.lifehacker.com/software/quicksilver/hack-attack-the-quicksilver-video-extravaganza-250949.php) for QS beginning once again, it seems like a good time. Plus, this literally just happened.

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](http://www.freeverse.com/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…”

Oh. Right.

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:

1. Invoke QS.
2. Type Command-‘ (that’s a single quote) to go to the Trigger preferences.
3. Create a new trigger by clicking the + button.
4. When the trigger pane drops down, press the period key to enter text mode.
5. Type “pbpaste | pbcopy” into the text field. (Or, for the slightly meta, you can copy and paste it from this post.)
6. Press tab – select “Run Command in Shell” as the action if it’s not already selected.
7. 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](http://vjarmy.com/archives/2006/01/quicksilver_gold_trigger.php).

Thanks again to [Mikey](http://www.mikey-san.net/) 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.