Credit where credit is due: First, I have to give the credit for this to Allan Odgaard (of TextMate fame) and Ciaran Walsh. I just jumped into ##textmate and served as the catalyst by bringing up the topic and getting the ball rolling.
For my pastie presentation at RailsConf 2008 I showed a little code, but it was all screen snaps. I've since been told of this semi-annoying 4-5 step process to go from TextMate pretty code to a Keynote slide... but no more...
First, copy the "Create HTML From Document / Selection" command... yes, using the ++ command to copy... you can't just make a new command because evidentally you need some secret XML sauce that the original has and your copy will inherit... then change the command source to the following:
Update: You must put the duplicated command in the TextMate bundle, or this won’t work.
ruby -e'
require "jcode"
$KCODE="U"
require "#{ENV["TM_BUNDLE_SUPPORT"]}/lib/doctohtml.rb"
require "#{ENV["TM_SUPPORT_PATH"]}/lib/progress.rb"
unit = ENV.has_key?("TM_SELECTED_TEXT") ? "selection" : "document"
TextMate.call_with_progress(:message => "Creating HTML version of #{unit}…") do
print document_to_html( STDIN.read, :include_css => true )
end'|textutil -convert rtf -stdin -stdout|pbcopy
echo 'Done!'
You can see we're just piping the output of TM's HTML generation into textutil to generate RTF. Then we're placing that on the clipboard. Here is what my dialog looks like:
You can assign the "Copy with Style" command to your own key binding... then it's as simple as copy/paste. Two keystrokes, done.
This seems to work great with Leopard, but still needs some testing on Tiger. It currently fails with an error about stdin. But hopefully this tip will help those of you preparing presentations with nicely colored Ruby code.

You must put the duplicated command in the TextMate bundle, or this won’t work.
Posted by: Ciarán Walsh | June 10, 2008 at 07:50 AM
I'm not sure, this is exactly, what you're looking for, but something like has already been done:
http://github.com/drnic/copy-as-rtf-tmbundle/tree/master
Nice approach though :)
Posted by: Mikkel | June 10, 2008 at 11:32 AM
Good old DrNic... guess I shouldn't be surprised he solved this already. :-) Looks like he actually wrote a Ruby RTF generator though, which is kind of cool and a totally different solution to the problem. Wonder if he just hadn't heard of textutil or if there is some hidden problem I haven't discovered yet.
Posted by: Josh Goebel | June 10, 2008 at 05:05 PM
This also works in PowerPoint if you go Edit > Paste Special as opposed to just paste (which means you can't Command+V)
I really need to buy iWork.
Posted by: Bryce | June 12, 2008 at 02:53 AM
Yes, you do need to buy iWork.
Posted by: Josh Goebel | June 12, 2008 at 03:29 AM
@Josh: Unfortunately, I am simply an OS X pawn in a Windows environment. Unless they make an iWork player for Windows.
Posted by: Bryce | June 13, 2008 at 02:14 AM