shell: how to pagination file with code highlight?

275 views Asked by At

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?

1

There are 1 answers

1
abligh On BEST ANSWER

Try

pygmentize -g mycodefile | less -R

so less shows ANSI colour sequences.