marleyos/modules/home/programs/bat/default.nix
2025-01-12 17:38:52 -08:00

81 lines
1.4 KiB
Nix

{
lib,
config,
# pkgs,
...
}: let
inherit (lib) mkEnableOption mkIf;
cfg = config.marleyos.programs.bat;
in {
options.marleyos.programs.bat.enable = mkEnableOption "bat";
config = mkIf cfg.enable {
programs.bat = {
enable = true;
# FIX: Currently broken. Re-enable when not broken.
# extraPackages = with pkgs.bat-extras; [
# batdiff
# batman
# ];
config = {
style = "auto";
};
};
home.sessionVariables = lib.mkIf config.programs.git.delta.enable {
# BATDIFF_USE_DELTA = "true";
};
programs.fish = {
functions = {
cat = {
wraps = "bat";
body =
# fish
"bat $argv";
};
cath = {
wraps = "bat";
body =
# fish
"bat --plain --language=help $argv";
};
};
};
home.shellAbbrs = {
B = {
position = "anywhere";
setCursor = true;
expansion =
# fish
"% | bat";
};
"-h" = {
position = "anywhere";
expansion =
# fish
"-h | cath";
};
"--help" = {
position = "anywhere";
expansion =
# fish
"--help | cath";
};
help = {
position = "anywhere";
expansion =
# fish
"help | cath";
};
};
};
}