Skip to content

Instantly share code, notes, and snippets.

@jeebak
Last active October 16, 2019 20:14
Show Gist options
  • Save jeebak/5321d9f24169dac15efe31dc03bca33a to your computer and use it in GitHub Desktop.
Save jeebak/5321d9f24169dac15efe31dc03bca33a to your computer and use it in GitHub Desktop.
Patch wofr06/lesspipe 1.83 to use bat
diff --git a/lesspipe.sh b/lesspipe.sh
index dc8c594..379cc12 100755
--- a/lesspipe.sh
+++ b/lesspipe.sh
@@ -527,8 +527,8 @@ isfinal() {
lang=${3#$sep}
lang="-l ${lang#.}"
lang=${lang%%-l }
- if cmd_exist code2color; then
- code2color $PPID ${in_file:+"$in_file"} $lang "$2"
+ if cmd_exist bat; then
+ bat --color=always ${in_file:+"$in_file"} "$2"
if [[ $? = 0 ]]; then
return
fi
@@ -856,8 +856,8 @@ isfinal() {
set "plain text" "$2"
fi
if [[ "$1" = *plain\ text* ]]; then
- if cmd_exist code2color; then
- code2color $PPID ${in_file:+"$in_file"} "$2"
+ if cmd_exist bat; then
+ bat --color=always ${in_file:+"$in_file"} "$2"
if [[ $? = 0 ]]; then
return
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment