about summary refs log tree commit diff
diff options
context:
space:
mode:
authorStarfall <us@starfall.systems>2022-08-29 12:42:54 -0500
committerStarfall <us@starfall.systems>2022-08-29 12:42:54 -0500
commit31c7f11bd66b7b7f5054af10a7b45de625cfba1c (patch)
tree425c99168f4a630554e02d205ef9f83edb6bd6c9
parent84366e7b4e35e774056ede4d103598e19a6892a9 (diff)
zsh: use bat as MANPAGER for syntax highlighting
-rw-r--r--.config/zsh/.zshenv7
1 files changed, 7 insertions, 0 deletions
diff --git a/.config/zsh/.zshenv b/.config/zsh/.zshenv
index eee33d7..c5d2066 100644
--- a/.config/zsh/.zshenv
+++ b/.config/zsh/.zshenv
@@ -10,3 +10,10 @@ if [[ $INTELLIJ -eq 1 ]]; then
 fi
 
 [[ -f "$HOME/.cargo/env" ]] &&  . "$HOME/.cargo/env"
+
+if command -v bat &> /dev/null; then
+	export MANPAGER="sh -c 'col -bx | bat --plain --language man'"
+	# note that mandoc needs a wrapper script e.g.:
+	# col -bx < "$1" | bat -p -l man
+	# <https://github.com/sharkdp/bat/issues/1145>
+fi