feat(home): Bat

This commit is contained in:
punkfairie 2024-11-16 12:21:24 -08:00
parent ce01e0ea57
commit d44822d587
Signed by: punkfairie
GPG key ID: A509E8F77FB9D696
3 changed files with 82 additions and 69 deletions

View file

@ -15,6 +15,7 @@ in
}; };
programs = { programs = {
amfora = enabled; amfora = enabled;
bat = enabled;
fish = enabled; fish = enabled;
journalctl = enabled; journalctl = enabled;
neo = enabled; neo = enabled;

View file

@ -0,0 +1,81 @@
{
lib,
config,
namespace,
pkgs,
...
}:
let
inherit (lib) mkIf;
inherit (lib.${namespace}) mkEnableModule enabled;
cfg = config.${namespace}.programs.bat;
inherit (config.${namespace}) theme;
in
{
options = mkEnableModule "programs.bat";
config = mkIf cfg.enable {
programs.bat = {
enable = true;
extraPackages = with pkgs.bat-extras; [
batdiff
batman
];
"${theme.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";
};
};
};
}

View file

@ -1,69 +0,0 @@
{
pkgs,
config,
lib,
...
}:
{
programs.bat = {
enable = true;
extraPackages = with pkgs.bat-extras; [
batdiff
batman
];
rose-pine.enable = true;
config = {
style = "auto";
};
};
home.sessionVariables = lib.mkIf config.home.preferXdgDirectories {
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";
};
};
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";
};
};
};
}