Add View Manpages With More Color Using Bat as a Unix TIL

This commit is contained in:
jbranchaud
2026-07-18 10:37:17 -05:00
parent 5ce584f0b9
commit aca5953a2e
2 changed files with 28 additions and 1 deletions
+2 -1
View File
@@ -10,7 +10,7 @@ working across different projects via [VisualMode](https://www.visualmode.dev/).
For a steady stream of TILs, [sign up for my newsletter](https://visualmode.kit.com/newsletter).
_1823 TILs and counting..._
_1824 TILs and counting..._
See some of the other learning resources I work on:
@@ -1875,6 +1875,7 @@ If you've learned something here, support my efforts writing daily TILs by
- [Use Regex Pattern Matching With Grep](unix/use-regex-pattern-matching-with-grep.md)
- [Use The Readline Keybindings Anywhere](unix/use-the-readline-keybindings-anywhere.md)
- [View A Web Page In The Terminal](unix/view-a-web-page-in-the-terminal.md)
- [View Manpages With More Color Using Bat](unix/view-manpages-with-more-color-using-bat.md)
- [View The Source For A Brew Formula](unix/view-the-source-for-a-brew-formula.md)
- [Watch The Difference](unix/watch-the-difference.md)
- [Watch This Run Repeatedly](unix/watch-this-run-repeatedly.md)
@@ -0,0 +1,26 @@
# View Manpages With More Color Using Bat
The default pager (program for display large text documents) for manpages is
`less`. That is, when I run something like `man git-log`, I am starting a `less`
process for viewing that document and I have access to all the features and
keybindings of `less`.
A comparable alternative to `less` is [`bat`](https://github.com/sharkdp/bat)
which support manpage-specific syntax highlighting. With the `-p` flag, `bat`
uses _plain_ styling which removes the extra formatting. With the `-l` flag I
can set the language for syntax highlighting to `man`.
```bash
MANPAGER="bat -plman" man git-log
```
That's a nice way to experiment with using `bat` as the man pager, but if I want
it set longterm I should add that env var setting for `MANPAGER` to my shell
config or [dotfiles](https://github.com/jbranchaud/dotfiles).
While `bat` is an improvement with the color that it sprinkles in, I am going to
stick with [neovim as my configured manpage viewer](https://www.visualmode.dev/a-better-man-page-viewer). Neovim gives me a
similar level of color plus a lot of other really nice features that only an
editor could provide.
[source](https://bsky.app/profile/tylerhillery.com/post/3mqunqyt44c2m)