From 72ecfa17097b0091ddf24eba5e0823ce434bb772 Mon Sep 17 00:00:00 2001 From: Martin Larsson Date: Thu, 8 May 2025 19:15:01 +0200 Subject: [PATCH] Fix manpager weird rendering and bat goodies --- zsh/.zshrc | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/zsh/.zshrc b/zsh/.zshrc index 68a847f..9c1604b 100644 --- a/zsh/.zshrc +++ b/zsh/.zshrc @@ -1,6 +1,16 @@ -# Change the system default editor to nvim +## Tell man/groff to output SGR escape codes (modern terminal formatting) +export MANROFFOPT="-c" + +# Configure MANPAGER to use bat, telling it it's a man page, and to handle wrapping/paging +export MANPAGER="sh -c 'sed -u -e \"s/\\x1B\[[0-9;]*m//g; s/.\\x08//g\" | bat -p -lman'" + +# Configure PAGER for general use (e.g., git log, diffs) +# You already had a good one: +export PAGER="bat --wrap=never --paging=always --style=plain" # --style=plain is optional here if you prefer bat's default + +# -R: handle colors, -S: chop long lines (no wrap), -F: quit if one screen, -X: no screen clear +export LESS="-RSFX" export EDITOR=nvim -export MANPAGER="sh -c 'col -bx | bat -l man -p'" set_custom_keybindings() { bindkey '^p' history-search-backward