Skip to content

Instantly share code, notes, and snippets.

@danreedy
Created June 15, 2011 14:28
Show Gist options
  • Save danreedy/1027224 to your computer and use it in GitHub Desktop.
Save danreedy/1027224 to your computer and use it in GitHub Desktop.
A Textmate bundle command for printing to preview from Textmate with syntax highlighting.
[ -n "$TM_FILEPATH" ] && \
PDF_FILE=~/Desktop/`date "+%y%m%d%H%M%S"`_`basename "$TM_FILEPATH"`.pdf
PS_FILE=/tmp/`basename "$TM_FILEPATH"`.ps
vim \
"+set number" "+syntax on" "+color slate" \
"+set printoptions=number:y" \
"+set printfont=consolas:h7" \
"+hardcopy > $PS_FILE" "+q" \
$TM_FILEPATH &>/dev/null && \
ps2pdf $PS_FILE $PDF_FILE && \
rm $PS_FILE && \
open $PDF_FILE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment