diff --git a/files/git/.config/git/config b/files/git/.config/git/config index 60b606d..577b1ea 100644 --- a/files/git/.config/git/config +++ b/files/git/.config/git/config @@ -128,7 +128,7 @@ defaultbranch = main templatedir = ~/.config/git/template [interactive] - diffFilter = delta --color-only + diffFilter = git-pager [mailinfo] scissors = true [merge] diff --git a/files/git/.local/bin/git-pager b/files/git/.local/bin/git-pager index 6b5faa2..646ab1f 100755 --- a/files/git/.local/bin/git-pager +++ b/files/git/.local/bin/git-pager @@ -1,6 +1,6 @@ #!/bin/sh -## SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. +## SPDX-FileCopyrightText: 2023 - 2024 Benjamin Grande M. S. ## ## SPDX-License-Identifier: AGPL-3.0-or-later @@ -9,5 +9,22 @@ set -eu if command -v delta >/dev/null; then exec delta "$@" else + : "${DIFF_HIGHLIGHT_SOURCE:=/usr/share/doc/git/contrib/diff-highlight}" + : "${DIFF_HIGHLIGHT_EXEC:=/usr/share/git-core/contrib/diff-highlight}" + + ## Debian. + if command -v perl && + test -f "${DIFF_HIGHLIGHT_SOURCE}/DiffHighlight.pm" && + test -f "${DIFF_HIGHLIGHT_SOURCE}/diff-highlight.perl" + then + exec perl -I "${DIFF_HIGHLIGHT_SOURCE}" -MDiffHighlight -- \ + "${DIFF_HIGHLIGHT_SOURCE}/diff-highlight.perl" | less -RS + + ## Fedora. + elif command -v perl && test -f "${DIFF_HIGHLIGHT_EXEC}" + then + exec "${DIFF_HIGHLIGHT_EXEC}" | less -RS + fi + exec less -RS "$@" fi