all repos — nixfiles @ 5fe0269a2d12e6e36cc379224fc6f4a49596612a

System and user configuration, managed by nix and home-manager

git: use difftastic (semantic diffs) in place of delta
Alan Pearce alan@alanpearce.eu
Tue, 04 Mar 2025 10:50:28 +0100
commit

5fe0269a2d12e6e36cc379224fc6f4a49596612a

parent

b3373e1c82b5fd0b19452709646306705a018598

2 files changed, 17 insertions(+), 2 deletions(-)

jump to
M user/settings/git.nixuser/settings/git.nix
@@ -12,11 +12,14 @@ enable = true;     userName = name;
     userEmail = email;
     delta = {
-      enable = true;
+      enable = false;
       options = {
         navigate = true;
         light = true;
       };
+    };
+    difftastic = {
+      enable = true;
     };
     extraConfig = {
       init = {
@@ -123,6 +126,12 @@ lg = "log --pretty=format:'%Cred%h%Creset -%Creset %s %Cgreen(%cr) %C(bold blue)<%an> %Cred%d%Creset'";       ignored = "ls-files --others -i --exclude-standard";
       clear = "clear-soft";
       clear-hard = "!git-clear-hard";
+      dlog = "-c diff.external=difft log --ext-diff";
+      dshow = "-c diff.external=difft show --ext-diff";
+      ddiff = "-c diff.external=difft diff";
+      dl = "dlog";
+      ds = "dshow";
+      dt = "ddiff";
     };
     ignores = [
       ".DS_Store"
@@ -148,6 +157,9 @@ settings = {       user = {
         inherit name email;
       };
+      ui = {
+        "diff.tool" = [ "${pkgs.difftastic}/bin/difft" "--color=always" "$left" "$right" ];
+      };
     };
   };
   home.packages = with pkgs; [
@@ -155,7 +167,6 @@ git-extras # delete-merged-branches and friends     git-worktree-switcher
     ghq
     # reduce these on server
-    delta
     gitui
     gitstatus
     hut # sourcehut tools
M user/settings/shell.nixuser/settings/shell.nix
@@ -77,8 +77,12 @@ dcr = "dc restart"; 
       ga = "git add";
       gs = "git st";
+      gds = "git dshow";
+      gsl = "git dshow";
       gd = "git diff";
       gdc = "git diff --cached";
+      gdd = "git ddiff";
+      gddc = "git ddiff --cached";
       gf = "git fetch";
       gk = "git push";
       gkf = "git push --force-with-lease";