From 9450422f08ef912b01fb0d9efbdd207d7ede0fff Mon Sep 17 00:00:00 2001 From: m3tm3re Date: Tue, 5 May 2026 19:16:53 +0200 Subject: [PATCH] feat(coding): enhance git, difftastic, and jj configuration - Git: set main as default branch, configure difftastic as external diff - Git: add useful aliases (co, br, lg, dft, ds, dl) - Git: enable rerere, zdiff3 conflicts, merge-based pulls - Difftastic: configure dark theme, Nix language support - JJ: use difftastic as diff formatter with color support --- profiles/sets/coding/core/git.nix | 93 ++++++++++++++++++++++++++++++- 1 file changed, 90 insertions(+), 3 deletions(-) diff --git a/profiles/sets/coding/core/git.nix b/profiles/sets/coding/core/git.nix index 4d91287..33a92a2 100644 --- a/profiles/sets/coding/core/git.nix +++ b/profiles/sets/coding/core/git.nix @@ -15,16 +15,79 @@ with lib; { email = lib.mkDefault "p@m3ta.dev"; }; core.excludesfile = "~/.gitignore_global"; - init.defaultBranch = "master"; + init.defaultBranch = "main"; + + # --- Diff-Config --- + # Use difftastic as default external diff tool + diff.external = "difft"; + diff.colorMoved = "default"; + + # --- Merge-Config --- + merge.conflictStyle = "zdiff3"; + + # --- Pull-Config --- + # Use merge instead of rebase for clearer history + pull.rebase = false; + + # --- Rerere --- + # Reuse recorded resolutions for recurring conflicts + rerere.enabled = true; + + # --- Push-Config --- + # Automatically set upstream when pushing to new branch + push.autoSetupRemote = true; + + # --- Pager --- + pager.diff = true; + pager.log = false; + + # --- Aliases --- alias = { + # Basic shortcuts st = "status"; - logd = "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"; + co = "checkout"; + br = "branch"; + + # Enhanced log with graph + lg = "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"; + + # Difftastic aliases for one-off usage + # Use with: git dft, git ds, git dl + dft = "-c diff.external=difft diff"; + ds = "-c diff.external=difft show --ext-diff"; + dl = "-c diff.external=difft log -p --ext-diff"; }; }; }; - programs.difftastic.enable = true; + # Difftastic configuration + programs.difftastic = { + enable = true; + options = { + # Anzeige: Passt zu den meisten Terminal-Themes + color = "dark"; + # Word-level diffs inline statt side-by-side + side-by-side = false; + + # Standard-Tab-Breite + tab-width = 8; + + # Trailing Commas anzeigen + trailing-commas = true; + + # Konsistente Diffs durch alphabetische Pfad-Sortierung + sort-paths = true; + + # Nix-spezifisch + language = [ + "Nix" + "Nanorc" + ]; + }; + }; + + # Jujutsu (jj) configuration programs.jujutsu = { enable = true; settings = { @@ -32,6 +95,30 @@ with lib; { email = "m@m3tam3re.com"; name = "Sascha Koenig"; }; + + # --- UI --- + ui = { + # Immer Farben (auch in Pipes) + color = "always"; + + # Log als Default-Command + default-command = "log"; + + # Schönerer Graph + graph-style = "curved"; + + # Pager-Config + pager = "less -FRX"; + paginate = "auto"; + + # --- Diff --- + # Difftastic als Default-Diff-Formatter + diff-formatter = ["difft" "--color=always" "$left" "$right"]; + }; + + # --- Revsets --- + # Zeige @, Parent-Änderungen und immutable Heads + revsets.log = "present(@) | @-:: | immutable_heads().."; }; };