Skip to main content
1 of 5
not2qubit
  • 1.8k
  • 2
  • 21
  • 24

Syntax highlighting of less, works just fine on most *nix systems. Even on Cygwin you can do it with the minor adjustment of the shell script path and installing with apt-cyg.

apt-cyg install source-highlight
export LESSOPEN="| /usr/bin/src-hilite-lesspipe.sh %s"
export LESS=' -R '

However, using this drastically slows down browsing of large files. I suggest to use alias in such a way to only implement the LESSOPEN export above when needed, like this:

alias lessh='LESSOPEN="| /usr/bin/src-hilite-lesspipe.sh %s" less -M '

where the -M flag is convenient to also show filename and line number.

not2qubit
  • 1.8k
  • 2
  • 21
  • 24