[clug] Coloured manpages

Hal Ashburner hal at ashburner.info
Mon Feb 17 18:04:12 MST 2014

Getting coloured output from manpages brought me some joy today! Hopefully
someone or other of you manages a smile. This is the kind of thing that
often get past me for years(!)


which can be wrapped like so:

man() {
    env \
        LESS_TERMCAP_mb=$(printf "\e[1;31m") \
        LESS_TERMCAP_md=$(printf "\e[1;38;5;74m") \
        LESS_TERMCAP_me=$(printf "\e[0m") \
        LESS_TERMCAP_se=$(printf "\e[0m") \
        LESS_TERMCAP_so=$(printf "\e[1;38;5;246m") \
        LESS_TERMCAP_ue=$(printf "\e[0m") \
        LESS_TERMCAP_us=$(printf "\e[04;38;5;146m") \
            man "$@"

if that floats your boat.

(also in my shellrc are settings for ls & grep which along with tweaks to
.hgrc and compiling with clang make me happy)

# Enable directory colours
[[ $OSTYPE == "linux" ]] && eval `dircolors`
[[ $OSTYPE == "linux" ]] && alias ls="ls --color=auto -F"
alias grep="grep --color=auto"

Hope you're having fun.

More information about the linux mailing list