1
0
Fork 0

Zsh: Add pygmentize and source-highlight as LESSOPEN candidates

Remove src-hilite-lesspipe.sh, it is a wrapper around source-highlight.
This commit is contained in:
tastytea 2022-03-22 01:00:14 +01:00
parent da67f29c6e
commit f4f8db2359
Signed by: tastytea
SSH Key Fingerprint: SHA256:FBkvrOlhq5use1XEttyUGT4bUTDVA1ar9SgIc9P03cM
2 changed files with 8 additions and 6 deletions

View File

@ -84,12 +84,14 @@ export LESS="--tabs=4 --RAW-CONTROL-CHARS --LONG-PROMPT"
if command -v highlight > /dev/null; then
LESSOPEN="| $(command -v highlight) --force --out-format=truecolor --style=base16/unikitty-reversible --stdout %s"
elif command -v src-hilite-lesspipe.sh > /dev/null; then
LESSOPEN="| $(command -v src-hilite-lesspipe.sh) %s"
elif command -v lesspipe.sh > /dev/null; then
LESSOPEN="| lesspipe.sh %s"
elif command -v pygmentize > /dev/null; then
LESSOPEN="| $(command -v pygmentize) -f terminal16m -g -O style=paraiso-dark %s"
elif command -v source-highlight > /dev/null; then
LESSOPEN="| $(command -v source-highlight) --failsafe --infer-lang --out-format=esc --style-file=esc.style --input=%s"
elif command -v lesspipe > /dev/null; then
LESSOPEN="| lesspipe %s"
LESSOPEN="| $(command -v lesspipe) %s"
elif command -v lesspipe.sh > /dev/null; then
LESSOPEN="| $(command -v lesspipe.sh) %s"
fi
export LESSOPEN

View File

@ -11,7 +11,7 @@
if [[ -t 1 ]] && [[ -n "${CATOPEN}" || -n "${LESSOPEN}" ]]; then
if [[ -z "${CATOPEN}" ]]; then
# Programs that won't work with cat
local -a known_bad=("lesspipe")
local -a known_bad=("lesspipe" "pygmentize" "source-highlight")
for baddy in ${known_bad}; do
if [[ "${LESSOPEN}" =~ "${baddy}" ]]; then
\cat "${@}"