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
This commit is contained in:
m3tm3re
2026-05-05 19:16:53 +02:00
parent d0921278e2
commit 9450422f08
+90 -3
View File
@@ -15,16 +15,79 @@ with lib; {
email = lib.mkDefault "p@m3ta.dev"; email = lib.mkDefault "p@m3ta.dev";
}; };
core.excludesfile = "~/.gitignore_global"; 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 = { alias = {
# Basic shortcuts
st = "status"; 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 = { programs.jujutsu = {
enable = true; enable = true;
settings = { settings = {
@@ -32,6 +95,30 @@ with lib; {
email = "m@m3tam3re.com"; email = "m@m3tam3re.com";
name = "Sascha Koenig"; 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()..";
}; };
}; };