summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rwxr-xr-xranger/data/scope.sh6
1 files changed, 4 insertions, 2 deletions
diff --git a/ranger/data/scope.sh b/ranger/data/scope.sh
index 19404019..add6fbc8 100755
--- a/ranger/data/scope.sh
+++ b/ranger/data/scope.sh
@@ -44,7 +44,7 @@ dump() { /bin/echo "$output"; }
 trim() { head -n "$maxln"; }
 
 # wraps highlight to treat exit code 141 (killed by SIGPIPE) as success
-highlight() { command highlight "$@"; test $? = 0 -o $? = 141; }
+safepipe() { "$@"; test $? = 0 -o $? = 141; }
 
 # Image previews, if enabled in ranger.
 if [ "$preview_images" = "True" ]; then
@@ -91,7 +91,9 @@ esac
 case "$mimetype" in
     # Syntax highlight for text files:
     text/* | */xml)
-        try highlight --out-format=ansi "$path" && { dump | trim; exit 5; } || exit 2;;
+        try safepipe highlight --out-format=ansi "$path" && { dump | trim; exit 5; }
+        try safepipe pygmentize "$path" && { dump | trim; exit 5; }
+        exit 2;;
     # Ascii-previews of images:
     image/*)
         img2txt --gamma=0.6 --width="$width" "$path" && exit 4 || exit 1;;