marleyos/modules/home/programs/bat/default.nix
punkfairie 15372b7726
feat: ${namespace} -> marleyos
There was little point to doing this anyway as project-wide find &
replace is trivial.
2024-11-16 22:36:34 -08:00

80 lines
1.4 KiB
Nix

{
lib,
config,
pkgs,
...
}:
let
inherit (lib) mkIf;
inherit (lib.marleyos) mkEnableModule enabled;
cfg = config.marleyos.programs.bat;
inherit (config.marleyos.theme) colors;
in
{
options = mkEnableModule "programs.bat";
config = mkIf cfg.enable {
programs.bat = {
enable = true;
extraPackages = with pkgs.bat-extras; [
batdiff
batman
];
"${colors.base}" = enabled;
config = {
style = "auto";
};
};
home.sessionVariables = lib.mkIf config.programs.git.delta.enable {
BATDIFF_USE_DELTA = "true";
};
programs.fish = lib.mkIf config.programs.fish.enable {
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";
};
};
};
}