Developer Syntax Highlighting for Presentations, Copy-And-Paste on the Mac

11 Jan 2009

Based on some Twitter conversations with @fredjean about the Codex Ruby Gem, I've been inspired to stop taking screenshots of code for slides and rather putting in formatted text. But this isn't as easy to do as it should be. Eclipse 3.4 has lost (for me, and others) the ability to copy and paste rich text so that it appears formatted in the paste destination. Maybe that's a MacOS failure of later Eclipse versions. No matter though, as I drift father from Eclipse usage. My favorite other two editors can fulfill this need nicely with two simple add-ons.

Jim Weirich's blog post about using Ruby and posting source as a means

Dave Thomas (@pragdave) chimes in with his similar thread about presenting code -- gasp -- without Keynote entire.

Textmate: Copy as RTF Bundle (Plugin)

This sweet plugin lets you copy formatted code of any language TextMate recognizes as RTF. Perfectly suitable for pasting into MS Word, Pages, TextEdit, or namely, Keynote. Install it via:

cd ~/Library/Application Support/TextMate/Bundles
git clone git://github.com/drnic/copy-as-rtf-tmbundle.git "Copy as RTF.tmbundle"

Initialized empty Git repository in /Users/mccm06/Library/Application Support/TextMate/Bundles/Copy as RTF.tmbundle/.git/
remote: Counting objects: 34, done.
remote: Compressing objects: 100% (17/17), done.
remote: Total 34 (delta 14), reused 34 (delta 14)
Receiving objects: 100% (34/34), 6.88 KiB, done.
Resolving deltas: 100% (14/14), done.

The copy:
200901111502.jpg

And the paste:
200901111503.jpg  

IntelliJ: Copy as HTML Plugin

Similar functionality works from IntelliJ. Just install the plugin "Copy to Clipboard as HTML".

200901111508.jpg

The copy:
200901111509.jpg

And, the paste:
200901111510.jpg