home: git: switch to 'delta'

Now that my issue with it has been resolved [1], let's switch to the
more mature tool.

This also solves a small issue that I had with `diff-highlight` which is
that non-highlighted text should not be boldened.

[1]: https://github.com/dandavison/delta/issues/544
This commit is contained in:
Bruno BELANYI 2021-03-19 23:17:49 +00:00
parent 48a9f9b11e
commit 281edd4eac

View file

@ -3,7 +3,6 @@ let
cfg = config.my.home.git; cfg = config.my.home.git;
inherit (lib.my) mkMailAddress; inherit (lib.my) mkMailAddress;
diff-highlight = "${pkgs.gitAndTools.gitFull}/share/git/contrib/diff-highlight/diff-highlight";
in in
{ {
options.my.home.git = with lib.my; { options.my.home.git = with lib.my; {
@ -40,6 +39,33 @@ in
lfs.enable = true; lfs.enable = true;
delta = {
enable = true;
options = {
features = "diff-highlight decorations";
# Less jarring style for `diff-highlight` emulation
diff-highlight = {
minus-style = "red";
minus-non-emph-style = "red";
minus-emph-style = "bold red 52";
plus-style = "green";
plus-non-emph-style = "green";
plus-emph-style = "bold green 22";
whitespace-error-style = "reverse red";
};
# Personal preference for easier reading
decorations = {
keep-plus-minus-markers = true;
paging = "always";
};
};
};
# There's more # There's more
extraConfig = { extraConfig = {
# Makes it a bit more readable # Makes it a bit more readable
@ -73,13 +99,6 @@ in
whitespace = "red reverse"; whitespace = "red reverse";
}; };
"color.diff-highlight" = {
oldNormal = "red bold";
oldHighlight = "red bold 52";
newNormal = "green bold";
newHighlight = "green bold 22";
};
commit = { commit = {
# Show my changes when writing the message # Show my changes when writing the message
verbose = true; verbose = true;
@ -100,16 +119,6 @@ in
defaultBranch = "main"; defaultBranch = "main";
}; };
interactive = {
diffFilter = "${diff-highlight}";
};
pager = {
diff = "${diff-highlight} | less";
log = "${diff-highlight} | less";
show = "${diff-highlight} | less";
};
pull = { pull = {
# Avoid useless merge commits # Avoid useless merge commits
rebase = true; rebase = true;