From 9ea5a40c70a8197c94eb5bf9531a7db54b5a7c3d Mon Sep 17 00:00:00 2001 From: Jonathan Schleifer Date: Sun, 24 May 2020 13:19:47 +0000 Subject: [PATCH] zshrc: Provide fallback when colordiff is missing --- zshrc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/zshrc b/zshrc index 3b02bdb..872b6d1 100644 --- a/zshrc +++ b/zshrc @@ -207,7 +207,14 @@ if which fossil &>/dev/null; then alias fsl="fossil" fsld() { - fossil diff -N "$@" | colordiff | less -FRX + if which colordiff &>/dev/null; then + fossil diff -N "$@" | colordiff | less -FRX + else + fossil diff -N "$@" | + sed "s/^+.*$/$(tput setaf 2)&$(tput sgr0)/" | + sed "s/^-.*$/$(tput setaf 1)&$(tput sgr0)/" | + less -FRX + fi } fi