[bash] colorize man pages

This commit is contained in:
Fernando Schauenburg 2018-09-20 19:40:25 +02:00
parent 78e76c2390
commit 7ed625cebd

18
bashrc
View file

@ -222,6 +222,24 @@ solarized() {
# Combined mkdir and cd
mkcd() { mkdir -p -- "$1" && cd -P -- "$1"; }
# Colorized `man`
man() {
if [ "$BACKGROUND" = "dark" ]; then
local standout="$base02;44" bold="$yellow" underline="$base3;4"
else
local standout="$base02;46" bold="$blue" underline="$base00;4"
fi
env \
LESS_TERMCAP_so=$(echo -ne "\e[${standout}m") \
LESS_TERMCAP_md=$(echo -ne "\e[${bold}m") \
LESS_TERMCAP_us=$(echo -ne "\e[${underline}m") \
LESS_TERMCAP_se=$'\e[0m' \
LESS_TERMCAP_me=$'\e[0m' \
LESS_TERMCAP_ue=$'\e[0m' \
man "$@"
}
# Apply customizations
bashrc_customize_environment
bashrc_customize_shell_options