Wednesday 27 November 2013

Adding Syntax Highlighting to Linux less

Install source-highlight:
 sudo apt-get install source-highlight  

Add the following two lines to~/.bashrc
 export LESSOPEN="| /usr/share/source-highlight/src-hilite-lesspipe.sh %s"  
 export LESS=' -R '  

Now source files opened with less will be nicely syntax highlighted. source-highlight supports many languages - see
 source-highlight --lang-list  
for a full listing.

No comments:

Post a Comment

Please leave a comment if you find this blog helpful or interesting! I'd love to hear from you!