Created
April 2, 2012 09:57
-
-
Save cormacrelf/2282279 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
# Usage: copy-rtf [file] | |
# | |
# Copies Pygmentize's RTF output of a source file to the clipboard after making it 36pt Monaco. | |
# | |
# Copy straight into an "Auto-Shrink" text box in Keynote for efficient code highlighting in a Coding presentation. | |
# Depends on [Pygments](http://pygments.org/) being installed in your $PATH... | |
# try `gem install pygmentize` for a standalone Ruby installation. | |
pygmentize -f rtf $1 | | |
# Replace the default Pygmentize font (Courier - ew) with Monaco. | |
sed "s/\\\\f0\\\\fmodern\\\\fprq1\\\\fcharset0/\\\\f0Monaco/g" | | |
# Set the font size to 36pt (that's the \fs72 - RTF font sizes work in doubles) | |
sed "s/\\\\f0/\\\\f0\\\\fs72/g" | | |
# And copy. Enjoy! | |
pbcopy | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment