From 290aab4efe10d63632dd07f60ba0f0da26948b07 Mon Sep 17 00:00:00 2001 From: John D Pell Date: Mon, 30 Aug 2021 22:09:37 -0700 Subject: [PATCH 1/2] plugins/man: Add "R" to `$LESS` Otherwise, `-R` must be added on the command line or colors just won't be rendered and these variables will be ignored. --- clean_files.txt | 1 + plugins/available/man.plugin.bash | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/clean_files.txt b/clean_files.txt index 8c8b3fed..1eb03108 100644 --- a/clean_files.txt +++ b/clean_files.txt @@ -101,6 +101,7 @@ plugins/available/java.plugin.bash plugins/available/jekyll.plugin.bash plugins/available/jump.plugin.bash plugins/available/less-pretty-cat.plugin.bash +plugins/available/man.plugin.bash plugins/available/node.plugin.bash plugins/available/nodenv.plugin.bash plugins/available/percol.plugin.bash diff --git a/plugins/available/man.plugin.bash b/plugins/available/man.plugin.bash index 473f04fd..282e2097 100644 --- a/plugins/available/man.plugin.bash +++ b/plugins/available/man.plugin.bash @@ -1,4 +1,4 @@ -cite about-plugin +# shellcheck shell=bash about-plugin 'colorize man pages for better readability' export LESS_TERMCAP_mb=$'\e[1;32m' @@ -8,3 +8,5 @@ export LESS_TERMCAP_se=$'\e[0m' export LESS_TERMCAP_so=$'\e[01;33m' export LESS_TERMCAP_ue=$'\e[0m' export LESS_TERMCAP_us=$'\e[1;4;31m' + +export LESS="R${LESS#-}" From dc5c9e107c08213e05adc0527bd1c5a9750bb650 Mon Sep 17 00:00:00 2001 From: John D Pell Date: Sat, 9 Oct 2021 10:16:02 -0700 Subject: [PATCH 2/2] plugin/man: simplify Don't overwrite variables that the user has already set. plugins/man: unbound `$LESS` --- plugins/available/man.plugin.bash | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/plugins/available/man.plugin.bash b/plugins/available/man.plugin.bash index 282e2097..b981565f 100644 --- a/plugins/available/man.plugin.bash +++ b/plugins/available/man.plugin.bash @@ -1,12 +1,14 @@ # shellcheck shell=bash about-plugin 'colorize man pages for better readability' -export LESS_TERMCAP_mb=$'\e[1;32m' -export LESS_TERMCAP_md=$'\e[1;32m' -export LESS_TERMCAP_me=$'\e[0m' -export LESS_TERMCAP_se=$'\e[0m' -export LESS_TERMCAP_so=$'\e[01;33m' -export LESS_TERMCAP_ue=$'\e[0m' -export LESS_TERMCAP_us=$'\e[1;4;31m' +: "${LESS_TERMCAP_mb:=$'\e[1;32m'}" +: "${LESS_TERMCAP_md:=$'\e[1;32m'}" +: "${LESS_TERMCAP_me:=$'\e[0m'}" +: "${LESS_TERMCAP_se:=$'\e[0m'}" +: "${LESS_TERMCAP_so:=$'\e[01;33m'}" +: "${LESS_TERMCAP_ue:=$'\e[0m'}" +: "${LESS_TERMCAP_us:=$'\e[1;4;31m'}" +: "${LESS:=}" +export "${!LESS_TERMCAP@}" export LESS="R${LESS#-}"