Consider this shell command:
$ MANPAGER='vim -Nu NONE -R -' man git-credential-cache
It makes man(1) display the man page of git-credential-cache(1) in Vim.
However, the name of the man page – as displayed on the first line of the buffer – is GIT-CREDENTIAL-CAC(1).
Notice how HE is missing at the end of the name:
I would expect this name instead:
GIT-CREDENTIAL-CACHE(1)
^^
I ran strace(1) to see which system calls were used by man(1):
$ MANPAGER='vim -Nu NONE -R -' strace -o log man git-credential-cache
Toward the end of the log file, I can see a read(2) and write(2) system call, using the buffer name GIT-CREDENTIAL-CAC(1):
read(7, "GIT-CREDENTIAL-CAC(1) "..., 4096) = 2720
...
write(8, "GIT-CREDENTIAL-CAC(1) "..., 2720) = 2720
So it seems that it's man(1) and not vim(1) which is truncating the name of the man page.
Here is the full contents of the log file, another log file containing the output of the same strace(1) command but with the additional -f argument to also trace the child processes, and the tree of processes leading to the man(1) process:
$ pstree -lsp $(pidof man)
systemd(1)---lightdm(947)---lightdm(1114)---upstart(1123)---sh(1324)---xfce4-session(1335)---xfce4-panel(1347)---panel-8-whisker(1396)---xterm(22546)---bash(22547)---strace(23182)---man(23184)---vim(23194)
Is there a way to prevent man(1) from truncating GIT-CREDENTIAL-CACHE(1) into GIT-CREDENTIAL-CAC(1)?
The reason why I ask this question is because the truncation causes an error message to be displayed when using the Neovim man plugin:
┌ Taken from `:h man.vim` in Neovim
├────────┐
$ MANPAGER='nvim +Man!' man git-credential-cache
man.vim: command error (7) man -w git-credential-cac: No manual entry for git-credential-cac
Environment:
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.6 LTS
Release: 16.04
Codename: xenial
$ man --version
man 2.7.5
$ vim --version | head -n2
VIM - Vi IMproved 8.1 (2018 May 18, compiled Sep 3 2019 11:05:36)
Included patches: 1-1967
$ nvim --version | head -n1
NVIM v0.4.0-1856-g82d52b229

