export MANPAGER="nvim +set\ filetype=man -"
I have this under my shell configuration, I've been using neovim as my man pager and one thing I love most is its table of contents functionality, pressing gO
or by calling man#show_toc()
function. Currently when I open a man page with man fzf
command for example, pressing gO
would bring location list at the bottom of the window like this
and the thing I want to see is this,
but it should be open automatically every time when I run man command.
call man#show_toc() | quit
vertical topleft lopen
vertical resize 40
setlocal nonumber norelativenumber
wincmd p
I could do by entering these commands by hand or putting them in a file named ftplugin/man.vim
but still it doesn't feel right, such like syntax highlighting doesn't work. Is there any better way to achieve this?