Contrib: a ZSH snippet (easily portable) to open man pages with bcat: bman
Closed this issue · 3 comments
nickstenning commented
Hey Ryan,
I thought I'd share this little ZSH snippet for viewing man pages with formatting using bcat. It turns out this is actually quite tedious to achieve, because roff uses overprinting to achieve bold, rather than real ANSI bold escape sequences (a hangover from daisy-wheel printer days!).
function bman {
colors
local bold=$'\\(.\\)\b\\1'
local ul=$'_\b\\(.\\)'
man ${@} | sed "s/${bold}/$fg_bold[blue]\1$reset_color/g;s/${ul}/$fg_bold[red]\1$reset_color/g" | bcat
}
Hope this is useful to someone.
rtomayko commented
AWESOME
pilt commented
Nice!
rtomayko commented
Ported that guy to posix shell and added to contrib directory here:
http://github.com/rtomayko/bcat/blob/master/contrib/bman
I'm thinking it might also be nice to support the ^H
based formatting with a2h(1)
or some other utility so that you can set bcat
as your MANPAGER
.