home: pager: fix colorized man pages

Turns out that sessionVariables are not being set at the proper time for
use with `tput`.

This commit also cleans up a bit how the config was being set.
This commit is contained in:
Bruno BELANYI 2021-05-09 21:13:24 +02:00
parent d87f37c572
commit abdba0a223

View file

@ -7,14 +7,18 @@ in
enable = mkDisableOption "pager configuration"; enable = mkDisableOption "pager configuration";
}; };
config.programs.lesspipe.enable = cfg.enable;
config.home.sessionVariables = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
programs.lesspipe.enable = true;
home.sessionVariables = {
# My default pager # My default pager
PAGER = "less"; PAGER = "less";
# Clear the screen on start and exit # Clear the screen on start and exit
LESS = "-R -+X -c"; LESS = "-R -+X -c";
};
programs.zsh.localVariables = {
# Colored man pages # Colored man pages
LESS_TERMCAP_mb = "$(tput bold; tput setaf 2)"; LESS_TERMCAP_mb = "$(tput bold; tput setaf 2)";
LESS_TERMCAP_md = "$(tput bold; tput setaf 6)"; LESS_TERMCAP_md = "$(tput bold; tput setaf 6)";
@ -30,4 +34,5 @@ in
LESS_TERMCAP_ZO = "$(tput ssupm)"; LESS_TERMCAP_ZO = "$(tput ssupm)";
LESS_TERMCAP_ZW = "$(tput rsupm)"; LESS_TERMCAP_ZW = "$(tput rsupm)";
}; };
};
} }