‘less’ on steroids

During the writing about XMonad i got this idea: why not filter source code through colouring program to get a colourful view, and why not do it automatically? Turns out less authors already had this idea πŸ™‚ ‘less’ allows to apply arbitrary filter through the usage of LESSPIPE environmental variable. See man less(1) for details.

There is already another utility for similar purpose: lesspipe. According to the project homepage it can handle various archive formats as well as source code. However, source code is filtered through utility code2color, which I’m not satisfied with. First of all, it doesn’t work as supposed to. For some reason it isn’t called and I really doesn’t feel like debugging the utility. There are no error messages, so I’m doesn’t really know why. Secondly I dislike it’s design:

  1. It’s a huge, single file with ~3300 lines.
  2. It doesn’t use any external libraries besides getopt. This means it handles all code coloring itself. This issue also affects #1
  3. As a result, the number of supported languages is small: only 21. This package available on Hackage currently supports 56. Including my favorite, Haskell πŸ™‚

I decided to write my own replacement for lesspipe. I’m going to post some details about this project soon. Stay tuned!


~ by Tener on 11/09/2009.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: