marleyos/modules/home/programs/bat/default.nix

82 lines
1.4 KiB
Nix
Raw Normal View History

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