Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This question already has an answer here:

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.

share|improve this question

marked as duplicate by guntbert, Eliah Kagan, Eric Carvalho, Radu Rădeanu, BuZZ-dEE Jan 21 '14 at 7:34

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

up vote 2 down vote accepted

It was easier than I expected. I must to use:

export LESSOPEN='|pygmentize %s'
share|improve this answer
without the -R option, less probably won't show the colours, but the raw escape codes – drevicko Feb 22 at 16:17

Yes, of course:

pygmentize -g /file/to/show | less -r
share|improve this answer
Maybe I wasn't enough clear in my question, but I was expecting to replace less for pygmentize.Thanks anyway – Alter Lagos Jan 16 '14 at 0:30

Not the answer you're looking for? Browse other questions tagged or ask your own question.