Man: Difference between revisions

From wikinotes
No edit summary
Line 12: Line 12:
= Configuration =
= Configuration =
<blockquote>
<blockquote>
= Width =
<blockquote>
Set manpage width with <code>$MANWIDTH</code>.
<syntaxhighlight lang="bash">
man() {
    local width
    local default_width
    default_width=100
    width=$(tput cols)
    test "$width" -gt "$default_width" && width=$default_width
    env MANWIDTH=$width man "$@"
}
</syntaxhighlight>
</blockquote><!-- Width -->
== Colours ==
== Colours ==
<blockquote>
<blockquote>

Revision as of 02:31, 5 October 2021

Unix manual pages.

Tutorials

gentoo wiki https://wiki.gentoo.org/wiki/Man_page

Configuration

Width

Set manpage width with $MANWIDTH.

man() {
    local width
    local default_width

    default_width=100
    width=$(tput cols)
    test "$width" -gt "$default_width" && width=$default_width

    env MANWIDTH=$width man "$@"
}

Colours

# on linux, you can control less colours using -D
#  -D{what}{modifier}{color}
env MANPAGER='less -R -DdY -Duw' man man

# across linux and BSD, you can set environment variables for less colours
# https://superuser.com/questions/117841/when-reading-a-file-with-less-or-more-how-can-i-get-the-content-in-colors
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;33m' # 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