Bläddra i källkod

Add pygments to less syntax highlighting.

`source-highlight` has some colour settings that don't go well with
solarized dark. Prefer `pygments` first.
Weiyi Lou 9 år sedan
förälder
incheckning
0e2de48759
2 ändrade filer med 7 tillägg och 2 borttagningar
  1. 1 0
      bin/show-versions
  2. 6 2
      shell/common/less.sh

+ 1 - 0
bin/show-versions

@@ -17,6 +17,7 @@ version_commands=( \
   'pandoc -v' \
   'pandoc-citeproc -V' \
   'tmuxinator version' \
+  'pygmentize -V' \
   'source-highlight -V' \
   )
 

+ 6 - 2
shell/common/less.sh

@@ -6,6 +6,10 @@
 # X = disable termcap init/deinit strings - sometimes these clear the screen.
 export LESS='-iRMX'
 
-if srchilitepath=$(command -v src-hilite-lesspipe.sh); then
-  export LESSOPEN="| $srchilitepath %s"
+# Try to perform syntax highlighting.
+# `pygments` has slightly friendlier defaults than `source-highlight`.
+if [[ -n $(command -v pygmentize) ]]; then
+  export LESSOPEN="| pygmentize -g %s"
+elif [[ -n $(command -v src-hilite-lesspipe.sh) ]]; then
+  export LESSOPEN="| src-hilite-lesspipe.sh %s"
 fi