bat-extras icon indicating copy to clipboard operation
bat-extras copied to clipboard

batman hangs when using BAT_PAGER

Open docwhat opened this issue 1 year ago • 2 comments

If I export BAT_PAGER=less then batman <page> hangs on macOS 13 & 14.

I can see (via PS) it running many copies of bat --language=man... until it hits a fork limit.

At the moment, I can reproduce at will.

docwhat avatar Sep 29 '23 20:09 docwhat

EDIT: no, my workaround doesn't work with the conky manual, something is wrong with formatting. I ended up just setting $MANPAGER to "$BAT_PAGER" (so not using bat anymore).

Non-working solution I tried finding a workaround by setting `$MANPAGER` but had some issues with it. Here's what I ended up with:
export PAGER="bat -p"
export BAT_PAGER="less -RF --jump-target=.5" # change to your liking

__myman() {
    man $@ | bat -l man -p
}

alias man="__myman"

For ZSH completion, put this after the autoload -U compinit line in your zshrc:

compdef _man __myman

Meaning "use the man completion for __myman".

tarneaux avatar Oct 11 '23 14:10 tarneaux

I can verify the same behavior here on both MacOS Sonoma and NixOS. Unsetting BAT_PAGER allows batman to work properly.

On a side note, setting MANPAGER to anything seems to be ignored.

mayersj1 avatar Feb 06 '24 19:02 mayersj1

That was quite the interesting one to debug. Thanks for finding this!

Fixed in commit 205e9c4.

eth-p avatar Feb 12 '24 09:02 eth-p

Released in v2024.02.12.

eth-p avatar Feb 12 '24 23:02 eth-p