diff options
author | Brian Picciano <me@mediocregopher.com> | 2024-04-14 15:57:56 +0200 |
---|---|---|
committer | Brian Picciano <me@mediocregopher.com> | 2024-04-14 15:57:56 +0200 |
commit | 895aa07eea96f718f57aa3157c51b0a4c3ef32d4 (patch) | |
tree | 9972015d770630ea447e4bd08e5d6c7f7fc3833f | |
parent | 2e1b0451ffbb789230f575d00e0741826a1a80fb (diff) |
Use difftastic for git diffing
-rw-r--r-- | base/gitconfig | 3 | ||||
-rw-r--r-- | default.nix | 13 |
2 files changed, 15 insertions, 1 deletions
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 |