I suggest a very nice tool called batcat provided by https://github.com/sharkdp/bat.
bat
package is available on Ubuntu since 20.04 ("Focal") and Debian since August 2021 (Debian 11 - "Bullseye")and its command is batcat
which is a cat replacement with wings.
From the git docu:
man
bat
can be used as a colorizing pager for man
, by setting the
MANPAGER
environment variable:
bash export MANPAGER="sh -c 'col -bx | batcat -l man -p'"
It might also be necessary to set MANROFFOPT="-c"
if you experience
formatting problems.
If you prefer to have this bundled in a new command, you can also use
batman.
Note that the Manpage
syntax is developed
in this repository and still needs some work.
Also, note that this will not
work with Mandocs man
implementation.
Install this bat package
sudo apt install bat
I love the Monokai theme and therefore I added this command into my .zshrc
:
export MANPAGER="sh -c 'col -bx | batcat -l man -p --theme 'Monokai Extended''"
In case you are using fish
shell add this line to your ~/.config/fish/config.fish
file:
set -x MANPAGER "sh -c 'col -bx | batcat -l man -p --theme 'Monokai Extended''"
A list of installed color-themes can be printed by following command
batcat --list-themes
Here a screenshot of man 3 printf