Home

Awesome

manpager

pre-commit.ci status github/workflow codecov DeepSource

github/downloads github/downloads/latest github/issues github/issues-closed github/issues-pr github/issues-pr-closed github/discussions github/milestones github/forks github/stars github/watchers github/contributors github/commit-activity github/last-commit github/release-date

github/license github/languages github/languages/top github/directory-file-count github/code-size github/repo-size github/v

Colorize man XXX.

man

Dependencies

This plugin will do nothing without dependencies.

Install

deb

Download *.deb firstly.

deb -i *.deb

rpm

Download *.rpm firstly.

rpm -i *.rpm

AUR

yay -S sh-manpager

NUR

nix-env -iA nur.repos.Freed-Wu.manpager

PPA

sudo add-apt-repository ppa:freedwu/ppa
sudo apt update
sudo apt install manpager

homebrew

brew tap Freed-Wu/manpager https://github.com/Freed-Wu/manpager
brew install manpager

Configure

Add the following code to your .bash_profile, .zprofile, ...

eval "$(manpager)"

Customize

You can define $MANPAGER to customize the colorization of man XXX.

Such as:

Disable Paging

export MANPAGER='manpager --paging=never'

Define n and p to Jump Forward and Backward Between Sections

export MANPAGER='manpager | less --pattern=^\\S+'

That is because man XXX looks like

MAN(1)                        Manual pager utils                        MAN(1)

NAME
       man - an interface to the system reference manuals

SYNOPSIS
       man [man options] [[section] page ...] ...
       ...

DESCRIPTION
       man is the system's manual pager.  Each page argument given to man is
       ...

So we can search ^\S+ forward and backward to jump between the lines started with NAME, SYNOPSIS, DESCRIPTION, etc.

Force to Colorize man XXX

You can man XXX | manpager to force to colorize man XXX.

Similar Projects

Details under the Hood

There are two different realizations of man:

So, our manpager must be compatible for both of them. There are some differences between them:

So we use [ -t 0 ] to judge current man is which man, then wrap it.

Related Projects