From 0a206737adaadb19838d518f349bf057c95fc060 Mon Sep 17 00:00:00 2001 From: mat ess Date: Sat, 19 Nov 2022 15:13:42 -0500 Subject: [PATCH] Restore bat color-setting --- home/fish.nix | 2 +- home/programs.nix | 20 +++++++++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/home/fish.nix b/home/fish.nix index 5f9b09b..9bcd95c 100644 --- a/home/fish.nix +++ b/home/fish.nix @@ -204,7 +204,7 @@ # Other ".." = "cd .."; ":q" = "exit"; - cat = "${bat}/bin/bat --style=plain"; + cat = "${bat}/bin/bat --style=plain --paging=never"; du = "${du-dust}/bin/dust"; g = "${gitAndTools.git}/bin/git"; ls = "${exa}/bin/exa"; diff --git a/home/programs.nix b/home/programs.nix index 7500fcc..8614888 100644 --- a/home/programs.nix +++ b/home/programs.nix @@ -17,9 +17,27 @@ in enable = true; config = { style = "auto"; - theme = "base16-256"; }; }; + # See `./shells.nix` for more on how this is used. + fish = { + functions = { + set-bat-colors = { + body = '' + if test "$term_background" = light + set -xg BAT_THEME "Monokai Extended Light" + else + set -xg BAT_THEME "TwoDark" + end + ''; + onVariable = "term_background"; + }; + }; + interactiveShellInit = '' + # Set `bat` colors based on value of `$term_backdround` when shell starts up. + set-bat-colors + ''; + }; # Direnv, load and unload environment variables depending on the current directory. # https://direnv.net # https://rycee.gitlab.io/home-manager/options.html#opt-programs.direnv.enable