Skip to content

Instantly share code, notes, and snippets.

@floere
Created May 9, 2013 12:22
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save floere/5547133 to your computer and use it in GitHub Desktop.
Save floere/5547133 to your computer and use it in GitHub Desktop.
Printing with line numbers, color, and wrapping into a PDF.
~/bin $ cat prettyprint
#!/bin/sh
PDF_FILE=/tmp/temp.pdf
PS_FILE=/tmp/temp.ps
vim \
"+set number" "+syntax on" "+color slate" \
"+set printoptions=number:y" \
"+set printfont=courier:h9" \
"+hardcopy > $PS_FILE" "+q" \
$1 &>/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