Syntax Highlighting Pager
Look for bat: A cat(1) clone with wings.
bat
supports syntax highlighting for a large number of programming and markup languages.
It is not a pager, but it automatically redirects output to less
if needed.
less -R
shows ANSI color sequences as-is (instead of expanding to caret notation). That'll make syntax highlighting work!
You can also create an environment variable LESS=-R
to make this the default behavior. Similarly for other options; see man less
.
Might I suggest vimpager
?
First off, recent vim
distributions (I believe 6.0 and above) come with a pager-esque-mode script. It's quite simple and functional, and operates similarly to less
. Try: vim '+help less' +only
.
Even better, however, Rafael Kitover has written a much more robust and powerful script called vimpager
. It's available on GitHub (or vimscripts). If you are on OS X and using Homebrew, it's as easy as brew install vimpager
.
At that point, you can simply set $PAGER=vimpager
, or even alias less=vimpager
. It works excellently.
You might try using jed. Yes, it's a text editor, not a pager, but it's quite lightweight and the default install contains excellent colorschemes for a wide variety of file types and languages.