<?xml version="1.0" encoding="UTF-8"?>
<feed xml:lang="en-US" xmlns="http://www.w3.org/2005/Atom">
  <title>This Entangled Bank: printing from Textmate</title>
  <subtitle type="html">may contain traces of knowledge</subtitle>
  <id>tag:entangledbank.co.uk,2005:Typo</id>
  <generator version="4.0" uri="http://www.typosphere.org">Typo</generator>
  <link href="http://entangledbank.co.uk/xml/atom/article/29/feed.xml" rel="self" type="application/atom+xml"/>
  <link href="http://entangledbank.co.uk/articles/2009/04/07/printing-from-textmate" rel="alternate" type="text/html"/>
  <updated>2010-01-22T14:27:28+00:00</updated>
  <entry>
    <author>
      <name>Ed</name>
    </author>
    <id>urn:uuid:0565a10c-f8bb-41af-9965-a0fcb2bf0006</id>
    <published>2009-04-07T20:02:00+01:00</published>
    <updated>2010-01-22T14:27:28+00:00</updated>
    <title type="html">printing from Textmate</title>
    <link href="http://entangledbank.co.uk/articles/2009/04/07/printing-from-textmate" rel="alternate" type="text/html"/>
    <category term="textmate" scheme="http://entangledbank.co.uk/articles/tag/textmate"/>
    <summary type="html">&lt;p&gt;Textmate is a great lightweight text editor but printing functionality is very poor. Here&amp;#8217;s a way suggested by &lt;a href="http://lists.macromates.com/textmate/2006-April/009412.html"&gt;Jeremy Wilkins&lt;/a&gt; to print out the current file or selection in small font size with line numbering. Put this command into a &amp;#8220;Command&amp;#8221; in the &amp;#8220;Bundle Editor&amp;#8221; and assign it to the keystroke &amp;#x2318;P if you like:&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;a2ps --center-title=`basename &amp;quot;$TM_FILEPATH&amp;quot;` --font-size 8 -C --pretty-print --columns 1 -M A4 -R --tabsize=2 --line-numbers 5 -o - - | ps2pdf14 -sPAPERSIZE=a4 - /Users/fred/misc/tm_print/textmate_print.pdf &amp;amp;&amp;amp; open -a /Applications/Preview.app /Users/fred/misc/tm_print/textmate_print.pdf&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;You will need &lt;code&gt;a2ps&lt;/code&gt; and &lt;code&gt;ps2pdf14&lt;/code&gt; also. The latter you should have but the former is available through macports:&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;sudo port install a2ps&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;h3&gt;&lt;span class="caps"&gt;UPDATE&lt;/span&gt;&lt;/h3&gt;


	&lt;p&gt;Another good solution which I use is to print from TextMate via vim which gives you a syntax-highlighted and line-numbered result (or however you choose to configure it.) In addition to vim it requires ps2pdf but these are easy to install with macports etc.&lt;/p&gt;


	&lt;p&gt;The only limitation is that the file needs to be saved first.&lt;/p&gt;


	&lt;p&gt;See this page which shows how to set up the macro as a TextMate &amp;#8216;command&amp;#8217;:&lt;/p&gt;


	&lt;p&gt;&lt;a href="http://biztos.blogspot.com/2008/06/printing-with-textmate-vim-and-friends.html"&gt;http://biztos.blogspot.com/2008/06/printing-with-textmate-vim-and-friends.htm&lt;/a&gt;&lt;/p&gt;</summary>
    <content type="html">&lt;p&gt;Textmate is a great lightweight text editor but printing functionality is very poor. Here&amp;#8217;s a way suggested by &lt;a href="http://lists.macromates.com/textmate/2006-April/009412.html"&gt;Jeremy Wilkins&lt;/a&gt; to print out the current file or selection in small font size with line numbering. Put this command into a &amp;#8220;Command&amp;#8221; in the &amp;#8220;Bundle Editor&amp;#8221; and assign it to the keystroke &amp;#x2318;P if you like:&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;a2ps --center-title=`basename &amp;quot;$TM_FILEPATH&amp;quot;` --font-size 8 -C --pretty-print --columns 1 -M A4 -R --tabsize=2 --line-numbers 5 -o - - | ps2pdf14 -sPAPERSIZE=a4 - /Users/fred/misc/tm_print/textmate_print.pdf &amp;amp;&amp;amp; open -a /Applications/Preview.app /Users/fred/misc/tm_print/textmate_print.pdf&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;You will need &lt;code&gt;a2ps&lt;/code&gt; and &lt;code&gt;ps2pdf14&lt;/code&gt; also. The latter you should have but the former is available through macports:&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;sudo port install a2ps&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;h3&gt;&lt;span class="caps"&gt;UPDATE&lt;/span&gt;&lt;/h3&gt;


	&lt;p&gt;Another good solution which I use is to print from TextMate via vim which gives you a syntax-highlighted and line-numbered result (or however you choose to configure it.) In addition to vim it requires ps2pdf but these are easy to install with macports etc.&lt;/p&gt;


	&lt;p&gt;The only limitation is that the file needs to be saved first.&lt;/p&gt;


	&lt;p&gt;See this page which shows how to set up the macro as a TextMate &amp;#8216;command&amp;#8217;:&lt;/p&gt;


	&lt;p&gt;&lt;a href="http://biztos.blogspot.com/2008/06/printing-with-textmate-vim-and-friends.html"&gt;http://biztos.blogspot.com/2008/06/printing-with-textmate-vim-and-friends.htm&lt;/a&gt;&lt;/p&gt;</content>
  </entry>
</feed>
