diff options
author | Mario Rodas <marsam@users.noreply.github.com> | 2020-04-26 04:20:00 -0500 |
---|---|---|
committer | Robert Helgesson <robert@rycee.net> | 2020-05-05 00:12:58 +0200 |
commit | cba7b6ee6e056421f862b008b45f1ff9cc2e7252 (patch) | |
tree | c7b7817d7e600f806874bd03e856d88e0707f999 /modules/programs/git.nix | |
parent | 03b4f81679456dc565722b38b18c27911b135d66 (diff) |
git: add basic support for delta
PR #1198
Diffstat (limited to 'modules/programs/git.nix')
-rw-r--r-- | modules/programs/git.nix | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/modules/programs/git.nix b/modules/programs/git.nix index 28f977894fc..ec2402f11f8 100644 --- a/modules/programs/git.nix +++ b/modules/programs/git.nix @@ -215,6 +215,24 @@ in { ''; }; }; + + delta = { + enable = mkEnableOption "" // { + description = '' + Whether to enable the <command>delta</command> syntax highlighter. + See <link xlink:href="https://github.com/dandavison/delta" />. + ''; + }; + + options = mkOption { + type = types.listOf types.str; + default = [ ]; + example = [ "--dark" ]; + description = '' + Extra command line options given to delta. + ''; + }; + }; }; }; @@ -309,5 +327,16 @@ in { ([ "git-lfs" "smudge" ] ++ skipArg ++ [ "--" "%f" ]); }; }) + + (mkIf cfg.delta.enable { + programs.git.iniContent = let + deltaArgs = [ "${pkgs.gitAndTools.delta}/bin/delta" ] + ++ cfg.delta.options; + in { + core.pager = concatStringsSep " " deltaArgs; + interactive.diffFilter = + concatStringsSep " " (deltaArgs ++ [ "--color-only" ]); + }; + }) ]); } |