make bat(1) use terminal colors

This commit is contained in:
Emma Tebibyte 2023-08-28 15:43:44 -06:00
parent 4a66427179
commit 5bbbd60cfc
Signed by: emma
GPG Key ID: 6D661C738815E7DD

4
en
View File

@ -1,6 +1,6 @@
#!/bin/sh -e
# Copyright (c) 2023 Emma Tebibyte
# Copyright (c) 2023 Emma Tebibyte <emma@tebibyte.media>
# SPDX-License-Identifier: FSFAP
#
# Copying and distribution of this file, with or without modification, are
@ -45,6 +45,8 @@ while test -n "$1"; do
# use bat for syntax highlighting if its available, but remove the frills
if command -v bat >/dev/null
then
# make bat use terminal theme
BAT_THEME=ansi; export BAT_THEME
# there has to be a temp file for writing the highlighted text to
syntax_h() {
printf "%s\n" "$1" >"$temp_highlight"