I've been using these variables for a long time to colourise man pages:
# Colourise man pages
export LESS_TERMCAP_mb=$'\E[1;31m' # begin bold
export LESS_TERMCAP_md=$'\E[1;36m' # begin blink
export LESS_TERMCAP_me=$'\E[0m' # reset bold/blink
export LESS_TERMCAP_so=$'\E[01;44;30m' # begin reverse video
export LESS_TERMCAP_se=$'\E[0m' # reset reverse video
export LESS_TERMCAP_us=$'\E[1;32m' # begin underline
export LESS_TERMCAP_ue=$'\E[0m' # reset underline
export LESS_TERMCAP_mr=$(tput rev)
export LESS_TERMCAP_mh=$(tput dim)
export LESS_TERMCAP_ZN=$(tput ssubm)
export LESS_TERMCAP_ZV=$(tput rsubm)
export LESS_TERMCAP_ZO=$(tput ssupm)
export LESS_TERMCAP_ZW=$(tput rsupm)
I am considering putting them into a function so that they don't clutter my environment variables (but then they don't work with
git apply --help
, but do with man git-apply
).
# Colourise man pages
man() {
env \
LESS_TERMCAP_mb=$'\E[1;31m' \
LESS_TERMCAP_md=$'\E[1;36m' \
LESS_TERMCAP_me=$'\E[0m' \
LESS_TERMCAP_so=$'\E[01;44;30m' \
LESS_TERMCAP_se=$'\E[0m' \
LESS_TERMCAP_us=$'\E[1;32m' \
LESS_TERMCAP_ue=$'\E[0m' \
LESS_TERMCAP_mr=$(tput rev) \
LESS_TERMCAP_mh=$(tput dim) \
LESS_TERMCAP_ZN=$(tput ssubm) \
LESS_TERMCAP_ZV=$(tput rsubm) \
LESS_TERMCAP_ZO=$(tput ssupm) \
LESS_TERMCAP_ZW=$(tput rsupm) \
man "$@"
}
Recently I have started using Oracle Linux and they don't work there. Oracle Linux is based on Scientific Linux (I think) so this probably doesn't work on RHEL and variants like CentOS/Fedora etc.
How can I make this work on all types of Linux?
Asked by paradroid
(1245 rep)
May 16, 2023, 07:18 PM
Last activity: May 16, 2023, 07:57 PM
Last activity: May 16, 2023, 07:57 PM