From 91fb4f28ef5d87e8bcf7749928d30ba4a9cbbd34 Mon Sep 17 00:00:00 2001 From: Azat Bahawi Date: Sun, 19 Feb 2023 17:50:35 +0300 Subject: 2023-02-19 --- modules/common/bat.nix | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 modules/common/bat.nix (limited to 'modules/common/bat.nix') 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 + ''; + }; + }; + }; +} -- cgit 1.4.1