title: Syntax Highlighting Pager
body: <p>Right now, I use <code>most</code> as my pager.  While it has helpful syntax highlighting for <code>man</code> pages, it lacks colored syntax highlighting for anything else (I'm specifically looking for diff/C++).</p>
  
  <p>Meanwhile, <code>pygments</code> is a wonderful program.  I can easily make colorized output with it:</p>
  
  <pre><code># ./pygmentize -f console256 ${file}
  hg diff | ./pygmentize -f console256 -l diff
  </code></pre>
  
  <p>Now, I would like to be able to page the output, so I just use:</p>
  
  <pre><code># ./pygmentize -f console256 ${file} | most
  hg diff | ./pygmentize -f console256 -l diff | most
  </code></pre>
  
  <p>At this point, most dumps all the colorizing control characters to my screen like so:</p>
  
  <pre><code>^[[38;5;28;01mclass^[[39;00m ^[[38;5;21;01mheap_allocator^[[39;00m
  {
  ^[[38;5;28;01mpublic^[[39;00m^[[38;5;241m:^[[39m
  </code></pre>
  
  <p>This is, of course, unreadable.  I looked though the <code>man</code> page for <code>most</code>, but I couldn't find any "Hey, show those control characters as colors instead of printing them" options.  <code>less</code> has the same garbage behavior as <code>most</code>, but <code>more</code> shows the colors perfectly fine, with the obvious limitations of being <code>more</code>.</p>
  
  <p>Is there a pager that supports syntax highlighting or some crazy combination of parameters and programs I can string together to make this work?  Ultimately, I would like to get diffs and logs from Mercurial to be highlighted, so maybe there is a shortcut in there...</p>