diff options
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | doc/ranger.1 | 12 | ||||
-rw-r--r-- | doc/ranger.pod | 9 | ||||
-rwxr-xr-x | ranger/data/scope.sh | 2 |
4 files changed, 20 insertions, 5 deletions
diff --git a/README.md b/README.md index 85f6137e..42893dc3 100644 --- a/README.md +++ b/README.md @@ -91,7 +91,7 @@ For enhanced file previews (with `scope.sh`): previews * `convert` (from `imagemagick`) to auto-rotate images and for SVG previews * `ffmpegthumbnailer` for video thumbnails -* `highlight` or `pygmentize` for syntax highlighting of code +* `highlight`, `bat` or `pygmentize` for syntax highlighting of code * `atool`, `bsdtar`, `unrar` and/or `7z` to preview archives * `bsdtar`, `tar`, `unrar` and/or `unzip` to preview archives as their first image diff --git a/doc/ranger.1 b/doc/ranger.1 index 3521d762..b22cb69f 100644 --- a/doc/ranger.1 +++ b/doc/ranger.1 @@ -1,4 +1,4 @@ -.\" Automatically generated by Pod::Man 4.10 (Pod::Simple 3.35) +.\" Automatically generated by Pod::Man 4.11 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== @@ -133,7 +133,7 @@ .\" ======================================================================== .\" .IX Title "RANGER 1" -.TH RANGER 1 "ranger-1.9.2" "2019-10-02" "ranger manual" +.TH RANGER 1 "ranger-1.9.2" "2019-12-21" "ranger manual" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l @@ -280,7 +280,8 @@ scripts by setting the option \f(CW\*(C`use_preview_script\*(C'\fR and \f(CW\*(C This default script is \fI\f(CI%rangerdir\fI/data/scope.sh\fR. It contains more documentation and calls to the programs \fIlynx\fR and \fIelinks\fR for html, \&\fIhighlight\fR for text/code, \fIimg2txt\fR for images, \fIatool\fR for archives, -\&\fIpdftotext\fR or \fImutool\fR for PDFs and \fImediainfo\fR for video and audio files. +\&\fIpdftotext\fR or \fImutool\fR for PDFs and \fImediainfo\fR for video and audio files +and others. .PP Install these programs (just the ones you need) and scope.sh will automatically use them. @@ -1710,6 +1711,11 @@ the \*(L"S\*(R" key. Defaults to \*(L"/bin/sh\*(R". .IX Item "TERMCMD" Defines the terminal emulator command that ranger is going to use with the :terminal command and the \*(L"t\*(R" run flag. Defaults to \*(L"xterm\*(R". +.IP "\s-1BAT_STYLE\s0" 8 +.IX Item "BAT_STYLE" +Specifies the theme to be used for syntax highlighting when \fIbat\fR is +installed, unless \fIhighlight\fR is also installed. Find out possible values by +running \f(CW\*(C`bat \-\-list\-themes\*(C'\fR. .IP "\s-1PYGMENTIZE_STYLE\s0" 8 .IX Item "PYGMENTIZE_STYLE" Specifies the theme to be used for syntax highlighting when \fIpygmentize\fR is diff --git a/doc/ranger.pod b/doc/ranger.pod index be964b37..988aabc0 100644 --- a/doc/ranger.pod +++ b/doc/ranger.pod @@ -193,7 +193,8 @@ scripts by setting the option C<use_preview_script> and C<preview_files> to true This default script is F<%rangerdir/data/scope.sh>. It contains more documentation and calls to the programs I<lynx> and I<elinks> for html, I<highlight> for text/code, I<img2txt> for images, I<atool> for archives, -I<pdftotext> or I<mutool> for PDFs and I<mediainfo> for video and audio files. +I<pdftotext> or I<mutool> for PDFs and I<mediainfo> for video and audio files +and others. Install these programs (just the ones you need) and scope.sh will automatically use them. @@ -1839,6 +1840,12 @@ the "S" key. Defaults to "/bin/sh". Defines the terminal emulator command that ranger is going to use with the :terminal command and the "t" run flag. Defaults to "xterm". +=item BAT_STYLE + +Specifies the theme to be used for syntax highlighting when I<bat> is +installed, unless I<highlight> is also installed. Find out possible values by +running C<bat --list-themes>. + =item PYGMENTIZE_STYLE Specifies the theme to be used for syntax highlighting when I<pygmentize> is diff --git a/ranger/data/scope.sh b/ranger/data/scope.sh index eb09b2bf..670d73d1 100755 --- a/ranger/data/scope.sh +++ b/ranger/data/scope.sh @@ -237,6 +237,8 @@ handle_mime() { env HIGHLIGHT_OPTIONS="${HIGHLIGHT_OPTIONS}" highlight \ --out-format="${highlight_format}" \ --force -- "${FILE_PATH}" && exit 5 + env COLORTERM=8bit bat --color=always --style="plain" \ + -- "${FILE_PATH}" && exit 5 pygmentize -f "${pygmentize_format}" -O "style=${PYGMENTIZE_STYLE}"\ -- "${FILE_PATH}" && exit 5 exit 2;; |