-
Install source-highlight
sudo apt install source-highlight
-
Configure it on your
.bash_profile
lessWithSourceHighlightSetup() {
# location of the script may vary
src_hilite_pipe_script=`dpkg -L libsource-highlight-common | grep lesspipe`
export LESSOPEN="| ${src_hilite_pipe_script} %s"
export LESS=' -R '
}
lessWithSourceHighlightSetup
- Use it on any code file
less -N /path/to/mycode.ext