aitjcize / cppman

C++ 98/11/14 manual pages for Linux/MacOS
GNU General Public License v3.0
1.27k stars 79 forks source link

Add neovim as pager #70

Closed z33ky closed 6 years ago

aitjcize commented 6 years ago

Couldn't you just alias vim as nvim? or simply set the PAGER variable.

z33ky commented 6 years ago

Aliases are generally not respected in shell scripts, unless the system-wide configuration is changed accordingly. I could add a symlink and add its directory to the PATH environment variable. Just setting PAGER could work, though I would also need to ensure I keep up-to-date with the flags passed to vim.

belkka commented 6 years ago

I have no vim installed (nvim only), but cppman just works.

z33ky commented 6 years ago

Well it has a fallback to less. Do you mean by works that it shows something or does it actually start nvim for you?

belkka commented 6 years ago

It actually starts neovim. I run $ cppman vector, then type :version<CR> and it shows a message

NVIM 0.1.7
Build type: None
Compilation: /usr/bin/cc -g -O2 \<a lot of options>...

z33ky commented 6 years ago

Weird. I just compiled cppman from git, but I still get less, even after cppman -p vim. What's the output of which vim && readlink -e "$(which vim)" on your system?

belkka commented 6 years ago
$ link="$(which vim)"
$ while echo -n "$link" && link="$(readlink "$link")" && echo -n ' -> '; do true; done; echo
/usr/bin/vim -> /etc/alternatives/vim -> /usr/bin/nvim

The package (debian) vim is not installed, neovim is

z33ky commented 6 years ago

My distro doesn't have an alternatives system that sets up such symlinks. In the hypothetical scenario where you have both neovim and vim installed, there would be no way of selecting either editor without changing the (global) symlink as well.

As mentioned before, one can still create a symlink in a private directory and add it to PATH, though then launching (non-neo)vim from a shell would be awkward, though not a common use-case I guess.

I do not see the issue with my proposed changes though.

aitjcize commented 6 years ago

you can just set your PAGER environment variable to nvim and it should just work.