summaryrefslogtreecommitdiff
path: root/modules/common/bat.nix
diff options
context:
space:
mode:
Diffstat (limited to 'modules/common/bat.nix')
-rw-r--r--modules/common/bat.nix40
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
+ '';
+ };
+ };
+ };
+}