<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>This Entangled Bank: printing from Textmate</title>
    <link>http://entangledbank.co.uk/articles/2009/04/07/printing-from-textmate</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>may contain traces of knowledge</description>
    <item>
      <title>printing from Textmate</title>
      <description>&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;</description>
      <pubDate>Tue, 07 Apr 2009 20:02:00 +0100</pubDate>
      <guid isPermaLink="false">urn:uuid:0565a10c-f8bb-41af-9965-a0fcb2bf0006</guid>
      <author>Ed</author>
      <link>http://entangledbank.co.uk/articles/2009/04/07/printing-from-textmate</link>
      <category>textmate</category>
    </item>
  </channel>
</rss>
