2

Specifically, on OSX, in zsh.

I'd like it when say...

man man

The background color is a darkish-yellow and the foreground is a charcoal gray/black. In this way I'm sure I'm looking at a man page and not some output.

I've tried to echo some escape codes before the command...

echo -e "\e[31m\e[43m"; man man

But I didn't get the desired effect, the background color "sort of" changed, but I get the impression man itself is producing escape codes that are canceling out mine.

I also tried digging around in the man.conf groff and grotty configuration but I didn't find anything, but that doesn't mean it isn't there.

I also thought maybe I could create a custom tty or something and export that but it's not clear to me how that would work either.

1 Answer 1

2

You could make use of LESS_TERMCAP_*s with a function like:

man() {
    env \
    LESS_TERMCAP_mb=$(printf "\e[1;31m") \
    LESS_TERMCAP_md=$(printf "\e[1;31m") \
    LESS_TERMCAP_me=$(printf "\e[0m") \
    LESS_TERMCAP_se=$(printf "\e[0m") \
    LESS_TERMCAP_so=$(printf "\e[1;44;33m") \
    LESS_TERMCAP_ue=$(printf "\e[0m") \
    LESS_TERMCAP_us=$(printf "\e[1;32m") \
    man "$@"
}

The above is what I use, and have sourced in my bashrc.

You can read through termcap(5) for more info, but I think se and so may be the ones you want to set.

1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .