Unix: Syntax Highlighting for "less"
All you need is: pygmentize ( python-pygments package ) and two lines in your "~/.bashrc"
Install Pygmentize:
sudo apt-get install python-pygments
Make "less" use it by editing "~/.bashrc" and adding these to the end:
export LESS='-R'
export LESSOPEN='|pygmentize -g %s'
The first line is to make sure that ANSI color escape sequences are output in raw form when using "less".
The second line is to allow pygmentize to preprocess the content before being passed on to "less" and "-g" flag will ask pygmentize to decide which syntax to use based on file content
Save the file then run this to start using it right away:
source ~/.bashrc
Written by Ramy Nasr
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Terminal
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#