TextMate News

Anything vaguely related to TextMate and macOS.

The shared find clipboard

One feature found in OS X which has grown on me is the shared find clipboard.

Since I have actually received a few bug reports related to (misunderstanding) this feature, I figured I’d go into what little detail there is about it.

I am sure that you are aware of the normal clipboard: select some text, press ⌘C to copy it to the clipboard, afterwards you can use ⌘V to paste it (repeatedly). This clipboard is shared by the entire system, so you can paste the text in every single application, big surprise! :)

Turns out there is a similar clipboard for search strings. Select text, press ⌘E and afterwards you can use ⌘G to find next occurrence of the string you copied to this find clipboard (use ⇧⌘G to find previous).

Like the text clipboard, this find clipboard is system-wide, and if you do inter-application searching, that’s very useful (the shortcuts themselves though are also useful). For example, I may see some output in the console or terminal that I want to search for in my source. I select that text, press ⌘E, switch to TextMate and simply press ⌘G (or ⇧⌘F for project wide search, and then return, since the search text field is pre-populated with the contents of the find clipboard).

It also goes the other way, like having something in my source code that I want to search for in my web browser (OmniWeb), someone quoting something in a letter (Mail) or over instant messaging (Adium), they all support this shared find clipboard, and they all use ⌘E for copy, and ⌘G for next occurrence.

One additional nicety is that Quicksilver uses the contents of the find clipboard as the default text for the various queries I have setup (Amazon, Cocoa Builder, CDDB, DSN, Google, MacUpdate, and a dozen other). E.g. I have a perl script which can dump the TV program, I may want to lookup a movie on IMDB, so I select it, press ⌘E (copy the movie title to the find clipboard), then ⌘ + space (bring up QS), im (for Internet Movie Database) and hit return twice (to accept the default text), and I’m on the results page from IMDB. I can even do ⌘G here, to make OmniWeb highlight what I searched for.

quicksilver query

I could go on about all the use cases for this, but it would really be like listing all the situations where cut’n’paste is useful! :)

Of course the above can still be done by using the “old” text clipboard, but generally requires a few extra key strokes and makes you lose the contents on the text clipboard. Especially while editing text, the extra find clipboard is useful, since searching can be done without having to bring up the find dialog, and preserving the contents on the standard clipboard.

categories General OS X Tips

13 Comments

02 October 2005

by Andreas Wahlin

(little fan post)
I knew about thit, but didn’t think it SO helpful, thanks a bunch man, even more power to the keyboard and quicksilver :)

Wow. Thanks for the explanation. That is totally helpful in more ways than you probably meant for this post. I’m also heavily considering checking out Quicksilver after a couple mentions from friends and now you Allan. Thank you.

I had no idea about those key commands -very cool and very helpful.

Thanks.

04 October 2005

by Dan Kelley

Why should I bother buying books on the mac, or reading those help files, when Allan is here to teach me everything good about the OS?

:-)

13 October 2005

by Pete Lasko

I wasn’t aware of a system wide find clipboard. BBEdit has command-h/command-g, but now this is so much better. You’ve just sold another copy of your app, my friend.

15 October 2005

by Niall O Broin

This is very handy, but unfortunately it seems that application support for it is not universal, even though it is supposedly system wide. Two apps I use regularly don’t support it viz. XChat Aqua and Firefox. Notably, neither of those apps. are “pure” Mac apps. - XChat Aqua is an Aqua port of the venerable X11 IRC client xchat and the Firefox web browser is also not a very good Mac citizen :-( - ignoring system proxy settings, and not cooperating very well with the Codetek Virtual Desktop.

16 November 2006

by BigGeoff

Works great in several applications (inc. textmate) but in quicksilver the text box doesn’t default to the contents of the find clipboard and is instead blank. Is there something else I need to turn on to make this work?

16 November 2006

by BigGeoff

Sorry, found it. Needed to restart Quicksliver. Great tip, thanks! Now if only Firefox supported it….

Weird - this doesn’t work for me in any application, cocoa or otherwise.

I’m stuck at the point where I need to hit return twice. I get sent to the search website’s main page without substituting the search term from the shared clipboard. Help! What am I missing?

Thanks in advance for your responses. This looks like an amazing shortcut.

30 April 2007

by Anonymous Hero

Another clipboard in MacOS that I found pleasantly surprising is the Font clipboard. In any RichText field, you can copy the font from a selection, and paste it onto some other text.

I love the find clipboard thanks to Textmate but I’m so bummed it isn’t accessible from Firefox.

How do I disable this “feature”? It’s the most annoying thing for me about TextMate. My browser and text editor are different applications used for vastly different purposes. If I do a search for some text on a webpage, it doesn’t make sense that I’ll always want to find that same text in my text editor. Although I can see the value in having the ability to share the clipboard on a case by case basis, most of the time it’s the wrong behaviour me

This has annoyed so many times, since I’ll often do a search in TextMate, go to my browser and do something involving a text search, and then return to TextMate intending to continue searching where I left off.