From 0e5c9358559054b0399028b747cf6f3137ef466c Mon Sep 17 00:00:00 2001 From: David Chen Date: Fri, 6 Mar 2020 17:43:05 -0800 Subject: [PATCH] highlight > ccat --- ranger/scope.sh | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/ranger/scope.sh b/ranger/scope.sh index 6709bf9..1508001 100755 --- a/ranger/scope.sh +++ b/ranger/scope.sh @@ -217,20 +217,10 @@ handle_mime() { case "${mimetype}" in # Text text/* | */xml) - # Syntax highlight - if [[ "$( stat --printf='%s' -- "${FILE_PATH}" )" -gt "${HIGHLIGHT_SIZE_MAX}" ]]; then - exit 2 + if command -v ccat 2>/dev/null; then + ccat --color=always ${FILE_PATH} + exit 0 fi - if [[ "$( tput colors )" -ge 256 ]]; then - local pygmentize_format='terminal256' - local highlight_format='xterm256' - else - local pygmentize_format='terminal' - local highlight_format='ansi' - fi - highlight --replace-tabs="${HIGHLIGHT_TABWIDTH}" --out-format="${highlight_format}" \ - --style="${HIGHLIGHT_STYLE}" --force -- "${FILE_PATH}" && exit 5 - # pygmentize -f "${pygmentize_format}" -O "style=${PYGMENTIZE_STYLE}" -- "${FILE_PATH}" && exit 5 exit 2;; # DjVu