weird escape characters when using nvim as a manpager

https://lemmy.world/post/3064702

weird escape characters when using nvim as a manpager - Lemmy.world

I use zsh and have export MANPAGER="nvim -Rc 'set ft=man' -" in my .zshrc. this used to work well but since a couple of weeks ago, whenever I run man (e.g. man man) I get many weird escape characters (e.g. MAN(1)). when running man and manually piping the output to another program (e.g. man man | nvim -Rc 'set ft=man' -) I don’t get these characters (e.g. MAN(1)). I haven’t manage to figure out why this happens or how to fix it. does anyone else have an idea?

I added this to my .zshrc after getting weird formatting in manpages. I do use bat as a my pager though so not too sure if it will help.

export MANROFFOPT='-c'

thanks! this didn’t solved my specific problem but caused another problem for me (e.g. _M_A_N(1)), but while searching about MANROFFOPT I came across a reddit post I had somehow missed when searching for a solution, and it it the actual solution was mentioned. what worked for me is export MANPAGER=‘nvim +Man!’ instead.
Issues using neovim as MANPAGER

I added `export MANPAGER="nvim -c 'set ft=man' -"` as `:help man` suggests, but when I open a manpage it looks like...

reddit