I found pygmentize
thanks to this answer, but it would be great if it could be used to highlight text with less
or maybe replace the command.
Is there a way to do that? Thanks in advance.
2 Answers
It was easier than I expected. I must to use:
export LESSOPEN='|pygmentize %s'
-
1without the
-R
option, less probably won't show the colours, but the raw escape codes– drevickoFeb 22, 2016 at 16:17
Yes, of course:
pygmentize -g /file/to/show | less -r
-
Maybe I wasn't enough clear in my question, but I was expecting to replace
less
forpygmentize
.Thanks anyway Jan 16, 2014 at 0:30