Offered: .lessfilter using pygments

Issue #802 resolved
Reuben Thomas
created an issue

The attached script runs pygmentize trying hard to guess the correct lexer. It uses zcat for transparent decompression (subject to a fix for issue #799), and file to find the file type (if pygmentize can't) and the encoding. (If issue #800 is fixed, this will work better.)

The script can be used as a .lessfilter to auto-color the popular less pager's output (that's why I wrote it).

Although the program depends on details of both file & pygmentize, and to be most obviously useful with less, it seems to me to belong naturally with pygments. Hence, I offer it for your consideration.

Apart from the two issues mentioned above, it's working well for me, and is up to date with pygments 1.5 and file 5.11 as regards its mapping of MIME types output by file to lexers.

Comments (2)

  1. Log in to comment