7

I tried export PAGER="nvim -R", however it does not work for man page, so I export MANPAGER="nvim -c 'set ft=man' -" again, it works. However it still does not work for git log, it looks like below:

Is there any way to solve all problems?

4

For git, you may want to use the the following configuration:

git config --global core.pager "nvim -R"

It can be a good idea to tell git to disable colors as it would conflict with neovim colors:

git config --global color.pager no

This second command fix the bug of your screenshot

| improve this answer | |
2

Using neovim and vim with update-alternatives:

sudo update-alternatives --install /usr/bin/vi vi /usr/bin/nvim 60
sudo update-alternatives --config vi
sudo update-alternatives --install /usr/bin/vim vim /usr/bin/nvim 60
sudo update-alternatives --config vim
sudo update-alternatives --install /usr/bin/editor editor /usr/bin/nvim 60
sudo update-alternatives --config editor

the configuration of update-alternatives print:

  Selection    Path                Priority   Status
------------------------------------------------------------
  0            /usr/bin/nvim        60        auto mode
* 1            /usr/bin/nvim        60        manual mode
  2            /usr/bin/vim.basic   30        manual mode

then exporting MANPAGER:

export MANPAGER="/bin/sh -c \"col -b | vim -c 'set ft=man ts=8 nomod nolist nonu noma' -\""
| improve this answer | |
1

nvimpager is an alternative solution.

export PAGER=nvimpager.

export MANPAGER=nvimpager.

git config --global color.pager no.

git config --global core.pager nvimpager.

| improve this answer | |
0

I had issues setting up nvim as MANPAGER because the following error appeared every time I tried to open a man page (such as man man):

fuse: mount failed: Permission denied

Cannot mount AppImage, please check your FUSE setup.
You might still be able to extract the contents of this AppImage
if you run it with the --appimage-extract option.
See https://github.com/AppImage/AppImageKit/wiki/FUSE
for more information
open dir error: No such file or directory
man: command exited with status 127: sed -e '/^[[:space:]]*$/{ N; /^[[:space:]]*\n[[:space:]]*$/D; }' | LESS=-ix8RmPm Manual page man(1) ?ltline %lt?L/%L.:byte %bB?s/%s..?e (END):?pB %pB\%.. (press h for help or q to quit)$PM Manual page man(1) ?ltline %lt?L/%L.:byte %bB?s/%s..?e (END):?pB %pB\%.. (press h for help or q to quit)$ MAN_PN=man(1) nvim -c set ft=man - 

Looking for alternatives, which I could not find, I ended up with the following zsh function and alias:

function my_man {
    $EDITOR +"Man $1|on"
}
alias man="my_man"

You need to activate a vim plugin that comes shipped with vim and nvim by adding the following line to your .vimrc:

runtime! ftplugin/man.vim
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.