

This can of course be improved further, accepting more extensions, multiple files, or parsing the shebang for other interpreters than bash. Run echo "$(lesspipe)" to see what it does. In your rc file instead of setting the LESSOPEN variable. lessfilter file, so everything said above works the same, you just have to run eval "$(lesspipe)" zshrc or equivalent) add export LESS='-R'Īlso, you need to make ~/.lessfilter executable by running chmod u+x ~/.lessfilterĮdit: If you have lesspipe on your system, you might want to use that to automatically unzip archives when looking at them with less, e.g. Install pygments with your package manager or pip (possibly called python-pygments) or get it here. You can utilize the power of pygmentize with less - automatically! (No need to pipe by hand.) If you just want to tell less to interpret color codes, use less -R.
