diff options
author | Azat Bahawi <azat@bahawi.net> | 2023-02-19 17:50:35 +0300 |
---|---|---|
committer | Azat Bahawi <azat@bahawi.net> | 2023-02-19 17:50:35 +0300 |
commit | 91fb4f28ef5d87e8bcf7749928d30ba4a9cbbd34 (patch) | |
tree | e07291fcb1cf62a561ffe58d1fd8e2968ff6fcb3 /modules/common/bat.nix | |
parent | 2023-02-15 (diff) |
2023-02-19
Diffstat (limited to 'modules/common/bat.nix')
-rw-r--r-- | modules/common/bat.nix | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/modules/common/bat.nix b/modules/common/bat.nix new file mode 100644 index 0000000..2b31d16 --- /dev/null +++ b/modules/common/bat.nix @@ -0,0 +1,40 @@ +{ + config, + lib, + pkgs, + ... +}: +with lib; let + cfg = config.nixfiles.modules.bat; +in { + options.nixfiles.modules.bat.enable = + mkEnableOption "bat, an alternative to cat"; + + config = mkIf cfg.enable { + hm.programs = { + bat = { + enable = true; + config = { + style = "plain"; + tabs = "4"; + theme = "base16"; + wrap = "never"; + }; + }; + + bash = { + shellAliases = let + bat = "${pkgs.bat}/bin/bat"; + in { + bay = "${bat} --language=yaml --tabs 2"; + baj = "${bat} --language=json --tabs 2"; + }; + + initExtra = mkAfter '' + _complete_alias bay _bat bat + _complete_alias baj _bat bat + ''; + }; + }; + }; +} |