Man: Difference between revisions

From wikinotes
Line 35: Line 35:
# on linux, you can control less colours using -D
# on linux, you can control less colours using -D
#  -D{what}{modifier}{color}
#  -D{what}{modifier}{color}
env MANPAGER='less -R -DdY -Duw' man man
env MANPAGER='less -R -DdY -Duw --mouse --wheel-lines=5' man man


# across linux and BSD, you can set environment variables for less colours
# across linux and BSD, you can set environment variables for less colours

Revision as of 03:03, 16 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 --mouse --wheel-lines=5' 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