about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--doc/ranger.18
-rw-r--r--doc/ranger.pod9
-rwxr-xr-xranger/data/scope.sh6
3 files changed, 16 insertions, 7 deletions
diff --git a/doc/ranger.1 b/doc/ranger.1
index afd8641a..b251edbe 100644
--- a/doc/ranger.1
+++ b/doc/ranger.1
@@ -1638,17 +1638,21 @@ Defines the terminal emulator command that ranger is going to use with the
 .IX Item "PYGMENTIZE_STYLE"
 Specifies the theme to be used for syntax highlighting when \fIpygmentize\fR is
 installed unless \fIhighlight\fR is also installed. Find out possible values by
-running
+running:
  python \-c 'import pygments.styles; [print(stl) for stl in
  pygments.styles.\fBget_all_styles()\fR]'
 .IP "\s-1HIGHLIGHT_STYLE\s0" 8
 .IX Item "HIGHLIGHT_STYLE"
 Specifies the theme to be used for syntax highlighting when \fIhighlight\fR is
 installed. Find out possible values by running \f(CW\*(C`highlight \-\-list\-themes\*(C'\fR.
+.IP "\s-1HIGHLIGHT_TABWIDTH\s0" 8
+.IX Item "HIGHLIGHT_TABWIDTH"
+Specifies the number of spaces to use to replace tabs in \fIhighlight\fRed files.
 .IP "\s-1HIGHLIGHT_OPTIONS\s0" 8
 .IX Item "HIGHLIGHT_OPTIONS"
 \&\fIhighlight\fR will pick up command line options specified in this variable. A
-\&\f(CW\*(C`\-\-style=\*(C'\fR option specified here will override \f(CW\*(C`HIGHLIGHT_STYLE\*(C'\fR.
+\&\f(CW\*(C`\-\-style=\*(C'\fR option specified here will override \f(CW\*(C`HIGHLIGHT_STYLE\*(C'\fR. Similarly,
+\&\f(CW\*(C`\-\-replace\-tabs=\*(C'\fR will override \f(CW\*(C`HIGHLIGHT_TABWIDTH\*(C'\fR..
 .IP "\s-1XDG_CONFIG_HOME\s0" 8
 .IX Item "XDG_CONFIG_HOME"
 Specifies the directory for configuration files. Defaults to \fI\f(CI$HOME\fI/.config\fR.
diff --git a/doc/ranger.pod b/doc/ranger.pod
index f78e9bdd..1c87c675 100644
--- a/doc/ranger.pod
+++ b/doc/ranger.pod
@@ -1785,7 +1785,7 @@ Defines the terminal emulator command that ranger is going to use with the
 
 Specifies the theme to be used for syntax highlighting when I<pygmentize> is
 installed unless I<highlight> is also installed. Find out possible values by
-running
+running:
  python -c 'import pygments.styles; [print(stl) for stl in
  pygments.styles.get_all_styles()]'
 
@@ -1794,10 +1794,15 @@ running
 Specifies the theme to be used for syntax highlighting when I<highlight> is
 installed. Find out possible values by running C<highlight --list-themes>.
 
+=item HIGHLIGHT_TABWIDTH
+
+Specifies the number of spaces to use to replace tabs in I<highlight>ed files.
+
 =item HIGHLIGHT_OPTIONS
 
 I<highlight> will pick up command line options specified in this variable. A
-C<--style=> option specified here will override C<HIGHLIGHT_STYLE>.
+C<--style=> option specified here will override C<HIGHLIGHT_STYLE>. Similarly,
+C<--replace-tabs=> will override C<HIGHLIGHT_TABWIDTH>.
 
 =item XDG_CONFIG_HOME
 
diff --git a/ranger/data/scope.sh b/ranger/data/scope.sh
index ba9edc50..e9c10916 100755
--- a/ranger/data/scope.sh
+++ b/ranger/data/scope.sh
@@ -35,9 +35,9 @@ FILE_EXTENSION_LOWER="$(printf "%s" "${FILE_EXTENSION}" | tr '[:upper:]' '[:lowe
 
 # Settings
 HIGHLIGHT_SIZE_MAX=262143  # 256KiB
-HIGHLIGHT_TABWIDTH=8
+HIGHLIGHT_TABWIDTH=${HIGHLIGHT_TABWIDTH:-8}
 HIGHLIGHT_STYLE=${HIGHLIGHT_STYLE:-pablo}
-HIGHLIGHT_OPTIONS="--style=${HIGHLIGHT_STYLE} ${HIGHLIGHT_OPTIONS:-}"
+HIGHLIGHT_OPTIONS="--replace-tabs=${HIGHLIGHT_TABWIDTH} --style=${HIGHLIGHT_STYLE} ${HIGHLIGHT_OPTIONS:-}"
 PYGMENTIZE_STYLE=${PYGMENTIZE_STYLE:-autumn}
 
 
@@ -229,7 +229,7 @@ handle_mime() {
                 local pygmentize_format='terminal'
                 local highlight_format='ansi'
             fi
-            env HIGHLIGHT_OPTIONS="${HIGHLIGHT_OPTIONS}" highlight --replace-tabs="${HIGHLIGHT_TABWIDTH}" \
+            env HIGHLIGHT_OPTIONS="${HIGHLIGHT_OPTIONS}" highlight \
                 --out-format="${highlight_format}" \
                 --force -- "${FILE_PATH}" && exit 5
             pygmentize -f "${pygmentize_format}" -O "style=${PYGMENTIZE_STYLE}"\