From 895aa07eea96f718f57aa3157c51b0a4c3ef32d4 Mon Sep 17 00:00:00 2001 From: Brian Picciano Date: Sun, 14 Apr 2024 15:57:56 +0200 Subject: Use difftastic for git diffing --- base/gitconfig | 3 +++ default.nix | 13 ++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/base/gitconfig b/base/gitconfig index eb1ca38..8732a4d 100644 --- a/base/gitconfig +++ b/base/gitconfig @@ -1,6 +1,9 @@ [include] path = custom +[diff] + external = "difft --display inline" + [push] default = simple diff --git a/default.nix b/default.nix index 2bec5ec..77e799d 100644 --- a/default.nix +++ b/default.nix @@ -47,7 +47,17 @@ in rec { git = pkgs.writeScriptBin "git" '' #!${pkgs.bash}/bin/bash export XDG_CONFIG_HOME=${gitConfig} - exec ${pkgs.git}/bin/git "$@" + bin="${pkgs.git}/bin/git" + + # Overwrite show an log sub-commands to always set --ext-diff. git aliases + # don't allow for overwritting sub-commands, or I'd use them instead. + if [ "$1" = "show" ] || [ "$1" = "log" ]; then + subCmd="$1" + shift + exec "$bin" "$subCmd" --ext-diff "$@" + fi + + exec "$bin" "$@" ''; bin = pkgs.buildEnv { @@ -78,6 +88,7 @@ in rec { pkgs.less pkgs.tmux pkgs.calc + pkgs2305.difftastic pkgs.man pkgs.man-pages -- cgit v1.2.3