0

I was checking that you can highlight code with pygmentize like:

pygmentize -g mycodefile

but for large files, I would like the ability to paginate the files like with less or more, but when I try:

pygmentize -g mycodefile | less

The output is not correct, example:

ESC[34mfromESC[39;49;00m ESC[04mESC[36mmodule

How can I paginate a file in shell with code highlight?

fedorqui
  • 275,237
  • 103
  • 548
  • 598
eLRuLL
  • 18,488
  • 9
  • 73
  • 99

1 Answers1

3

Try

pygmentize -g mycodefile | less -R

so less shows ANSI colour sequences.

abligh
  • 24,573
  • 4
  • 47
  • 84