From 2fbf67507ffd5980489e8e693091abc96548e613 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Tue, 9 Jul 2024 14:15:46 +0100 Subject: [PATCH] git: use `difftastic` by default As described in https://difftastic.wilfred.me.uk/git.html#difftastic-by-default, the `--ext-diff` option needs to be used for difftastic to be used on commands other than `git diff`, such as `git show` or `git log`. > This only applies to git diff. For other git commands, you still need to specify --ext-diff, or use an alias as described above. ```shell $ git diff $ git show HEAD --ext-diff $ git log -p --ext-diff ``` > Conversely, if you need to copy/paste a diff in the standard diff format, you can use git diff --no-ext-diff. --- lib/shared/modules/zsh.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/shared/modules/zsh.nix b/lib/shared/modules/zsh.nix index ff04d02..d15f4b6 100644 --- a/lib/shared/modules/zsh.nix +++ b/lib/shared/modules/zsh.nix @@ -20,6 +20,11 @@ else (cd "''${ROOT}" && eval "''${@}") fi + elif [[ "''$1" == "log" || "''$1" == "show" ]]; then + local command="$1" + shift 1 + + ${pkgs.git}/bin/git "$command" --ext-diff "$@" else ${pkgs.git}/bin/git "''${@}" fi