git: configure delta through [delta] git section (#1371)
this breaks backwards compatibility (now accepts a dict instead of a list) so please update programs.git.delta.options accordingly.
This commit is contained in:
parent
5c639ff68a
commit
4bd0ca2cd7
|
@ -225,11 +225,23 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
options = mkOption {
|
options = mkOption {
|
||||||
type = types.listOf types.str;
|
type = with types;
|
||||||
default = [ ];
|
let
|
||||||
example = [ "--dark" ];
|
primitiveType = either str (either bool int);
|
||||||
|
sectionType = attrsOf primitiveType;
|
||||||
|
in attrsOf (either primitiveType sectionType);
|
||||||
|
default = { };
|
||||||
|
example = {
|
||||||
|
features = "decorations";
|
||||||
|
whitespace-error-style = "22 reverse";
|
||||||
|
decorations = {
|
||||||
|
commit-decoration-style = "bold yellow box ul";
|
||||||
|
file-style = "bold yellow ul";
|
||||||
|
file-decoration-style = "none";
|
||||||
|
};
|
||||||
|
};
|
||||||
description = ''
|
description = ''
|
||||||
Extra command line options given to delta.
|
Options to configure delta.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -329,14 +341,13 @@ in {
|
||||||
})
|
})
|
||||||
|
|
||||||
(mkIf cfg.delta.enable {
|
(mkIf cfg.delta.enable {
|
||||||
programs.git.iniContent = let
|
programs.git.iniContent =
|
||||||
deltaArgs = [ "${pkgs.gitAndTools.delta}/bin/delta" ]
|
let deltaCommand = "${pkgs.gitAndTools.delta}/bin/delta";
|
||||||
++ cfg.delta.options;
|
in {
|
||||||
in {
|
core.pager = deltaCommand;
|
||||||
core.pager = concatStringsSep " " deltaArgs;
|
interactive.diffFilter = "${deltaCommand} --color-only";
|
||||||
interactive.diffFilter =
|
delta = cfg.delta.options;
|
||||||
concatStringsSep " " (deltaArgs ++ [ "--color-only" ]);
|
};
|
||||||
};
|
|
||||||
})
|
})
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,16 @@
|
||||||
gpgSign = true
|
gpgSign = true
|
||||||
|
|
||||||
[core]
|
[core]
|
||||||
pager = "@deltaCommand@ --dark"
|
pager = "@deltaCommand@"
|
||||||
|
|
||||||
|
[delta]
|
||||||
|
features = "decorations"
|
||||||
|
whitespace-error-style = "22 reverse"
|
||||||
|
|
||||||
|
[delta "decorations"]
|
||||||
|
commit-decoration-style = "bold yellow box ul"
|
||||||
|
file-decoration-style = "none"
|
||||||
|
file-style = "bold yellow ul"
|
||||||
|
|
||||||
[extra]
|
[extra]
|
||||||
boolean = true
|
boolean = true
|
||||||
|
@ -32,7 +41,7 @@
|
||||||
program = "path-to-gpg"
|
program = "path-to-gpg"
|
||||||
|
|
||||||
[interactive]
|
[interactive]
|
||||||
diffFilter = "@deltaCommand@ --dark --color-only"
|
diffFilter = "@deltaCommand@ --color-only"
|
||||||
|
|
||||||
[user]
|
[user]
|
||||||
email = "user@example.org"
|
email = "user@example.org"
|
||||||
|
|
|
@ -60,7 +60,15 @@ in {
|
||||||
lfs.enable = true;
|
lfs.enable = true;
|
||||||
delta = {
|
delta = {
|
||||||
enable = true;
|
enable = true;
|
||||||
options = [ "--dark" ];
|
options = {
|
||||||
|
features = "decorations";
|
||||||
|
whitespace-error-style = "22 reverse";
|
||||||
|
decorations = {
|
||||||
|
commit-decoration-style = "bold yellow box ul";
|
||||||
|
file-style = "bold yellow ul";
|
||||||
|
file-decoration-style = "none";
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue