about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorWojciech Siewierski <wojciech.siewierski@onet.pl>2019-05-15 21:53:34 +0200
committerGitHub <noreply@github.com>2019-05-15 21:53:34 +0200
commit7028e133adbf4fdd0b7179c9c0b4b3349375c154 (patch)
tree90d5ebcffe8d5fefc6f4d5923adf26f8f17d38a9
parent5ae67755cfa84177613b48a698b4ed58e9751fc4 (diff)
parent99f8f00164425268e95b320b7ce696c1a380a7ed (diff)
downloadranger-7028e133adbf4fdd0b7179c9c0b4b3349375c154.tar.gz
Merge pull request #1557 from toonn/flexible_highlight
Scope no longer interferes with users' configuration
-rwxr-xr-xranger/data/scope.sh13
1 files changed, 8 insertions, 5 deletions
diff --git a/ranger/data/scope.sh b/ranger/data/scope.sh
index 33666fcb..ba9edc50 100755
--- a/ranger/data/scope.sh
+++ b/ranger/data/scope.sh
@@ -36,8 +36,9 @@ FILE_EXTENSION_LOWER="$(printf "%s" "${FILE_EXTENSION}" | tr '[:upper:]' '[:lowe
 # Settings
 HIGHLIGHT_SIZE_MAX=262143  # 256KiB
 HIGHLIGHT_TABWIDTH=8
-HIGHLIGHT_STYLE='pablo'
-PYGMENTIZE_STYLE='autumn'
+HIGHLIGHT_STYLE=${HIGHLIGHT_STYLE:-pablo}
+HIGHLIGHT_OPTIONS="--style=${HIGHLIGHT_STYLE} ${HIGHLIGHT_OPTIONS:-}"
+PYGMENTIZE_STYLE=${PYGMENTIZE_STYLE:-autumn}
 
 
 handle_extension() {
@@ -228,9 +229,11 @@ handle_mime() {
                 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
+            env HIGHLIGHT_OPTIONS="${HIGHLIGHT_OPTIONS}" highlight --replace-tabs="${HIGHLIGHT_TABWIDTH}" \
+                --out-format="${highlight_format}" \
+                --force -- "${FILE_PATH}" && exit 5
+            pygmentize -f "${pygmentize_format}" -O "style=${PYGMENTIZE_STYLE}"\
+                -- "${FILE_PATH}" && exit 5
             exit 2;;
 
         # DjVu