Skip to content

Instantly share code, notes, and snippets.

@zamaterian
Created December 13, 2011 13:08
Show Gist options
  • Save zamaterian/1472076 to your computer and use it in GitHub Desktop.
Save zamaterian/1472076 to your computer and use it in GitHub Desktop.
Clojure highlightning for cli less via source-hightlight
# add to .bashrc or .profile
export LESSOPEN="| /usr/share/source-highlight/src-hilite-lesspipe.sh %s"
export LESS=' -R '
# Clojure syntax highlighting for GNU source-highlight
# # rocks with SHJS
# add file in /usr/share/source-highlight/
comment start ";"
include "number.lang"
vardef SPECIALCHAR = '\\.'
environment string delim "\"" "\"" begin
specialchar = $SPECIALCHAR
end
type = "int|byte|boolean|char|long|float|double|short|void"
vardef FUNCTION = '\(([[:alpha:]]|_)[[:word:]]*(?=[[:blank:]]*)'
function = $FUNCTION
include "symbols.lang"
#! /bin/bash
# in /usr/share/source-highlight/src-hilite-lesspipe.sh
for source in $1; do
case $source in
*clojure|*clj)
source-highlight --failsafe -f esc --lang-def=clojure.lang --style-file=esc.style -i $source ;;
*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
@griff
Copy link

griff commented Dec 13, 2011

Gists support files. No need to have one big BLOB of text for 3 files.

@zamaterian
Copy link
Author

:-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment