Last active
October 10, 2015 13:08
-
-
Save combusean/3695143 to your computer and use it in GitHub Desktop.
Color less instructions on OS X
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1) Run | |
brew install source-highlight | |
Presuming you are using brew, of course. | |
2) Create the file /usr/local/share/source-highlight/src-hilite-lesspipe.sh | |
with the following as its contents | |
#!/bin/bash | |
for source in "$@"; do | |
case $source in | |
*ChangeLog|*changelog) | |
source-highlight --failsafe -f esc --lang-def=changelog.lang --style-file=esc.style -i "$source" ;; | |
*Makefile|*makefile) | |
source-highlight --failsafe -f esc --lang-def=makefile.lang --style-file=esc.style -i "$source" ;; | |
*) source-highlight --failsafe --infer-lang -f esc --style-file=esc.style -i "$source" ;; | |
esac | |
done | |
For some dumb reason, the above bash script doesn't get installed with source-highlight, | |
so I had to extract the above from the tarball's installation files. | |
3) chmod a+rx the above file. | |
4) Add the following lines to your ~/.profile (or equivalent) | |
export LESSOPEN="| /usr/local/share/source-highlight/src-hilite-lesspipe.sh %s" | |
export LESS=' -R ' | |
I think this is it. | |
--sean |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
awesome, thanks for sharing