diff options
author | hut <hut@lepus.uberspace.de> | 2016-03-20 21:49:50 +0100 |
---|---|---|
committer | hut <hut@lepus.uberspace.de> | 2016-03-20 21:49:50 +0100 |
commit | 09c30cdf4b9050d548e12b5108581680357ac5f1 (patch) | |
tree | b3f0af5267ae13cf147b1c5f320f424459a9e8ae /ranger | |
parent | 68661c2cc742923abd9355d5224e526541a356cb (diff) | |
parent | 2154834ff6a03698b83e224b9155379a4c22918f (diff) | |
download | ranger-09c30cdf4b9050d548e12b5108581680357ac5f1.tar.gz |
Merge branch 'color256' of https://github.com/lverweijen/ranger
Diffstat (limited to 'ranger')
-rwxr-xr-x | ranger/data/scope.sh | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/ranger/data/scope.sh b/ranger/data/scope.sh index afaf131f..669d1e34 100755 --- a/ranger/data/scope.sh +++ b/ranger/data/scope.sh @@ -91,8 +91,15 @@ esac case "$mimetype" in # Syntax highlight for text files: text/* | */xml) - try safepipe highlight --out-format=ansi "$path" && { dump | trim; exit 5; } - try safepipe pygmentize "$path" && { dump | trim; exit 5; } + if [ "$(tput colors)" -ge 256 ]; then + pygmentize_format=terminal256 + highlight_format=xterm256 + else + pygmentize_format=terminal + highlight_format=ansi + fi + try safepipe highlight --out-format=${highlight_format} "$path" && { dump | trim; exit 5; } + try safepipe pygmentize -f ${pygmentize_format} "$path" && { dump | trim; exit 5; } exit 2;; # Ascii-previews of images: image/*) |