From 935af00f8169169403592ffcf0346b3e7dccc274 Mon Sep 17 00:00:00 2001 From: punkfairie Date: Tue, 29 Oct 2024 20:13:02 -0700 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat(bat):=20Add=20fish=20config?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- home/bat/default.nix | 48 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) diff --git a/home/bat/default.nix b/home/bat/default.nix index d93fc36..1e810e8 100644 --- a/home/bat/default.nix +++ b/home/bat/default.nix @@ -1,4 +1,9 @@ -{pkgs, ...}: { +{ + pkgs, + config, + lib, + ... +}: { programs.bat = { enable = true; @@ -13,4 +18,45 @@ style = "auto"; }; }; + + programs.fish = lib.mkIf config.programs.fish.enable { + interactiveShellInit = '' + set -gx BATDIFF_USE_DELTA true + ''; + + functions = { + cat = { + wraps = "bat"; + body = "bat $argv"; + }; + + cath = { + wraps = "bat"; + body = "bat --plain --language=help $argv"; + }; + }; + + shellAbbrs = { + B = { + position = "anywhere"; + setCursor = true; + expansion = "% | bat"; + }; + + "-h" = { + position = "anywhere"; + expansion = "-h | cath"; + }; + + "--help" = { + position = "anywhere"; + expansion = "--help | cath"; + }; + + help = { + position = "anywhere"; + expansion = "help | cath"; + }; + }; + }; }