Open DerekNonGeneric opened 1 year ago
You are right, man npm
pulls up the man page for the system node, not the version managed by nvm.
Edit: Typo
You are right,
man nom
pulls up the man page for the system node, not the version managed by nvm.
You probably mean man npm
, but yeah, so confirmed bug i guess -- i would like it fixed too :)
The following may be helpful in the meantime, but will let you know about any progress (can make a PR too).
I might have a potential fix for this, but I'm currently stuck because of an issue with Fish that breaks man
for other commands after updating $MANPATH.
Here's the code to support man npm:
contains -- $nvm_data/$ver/lib/node_modules/npm/man $MANPATH ||
set --global --prepend MANPATH $nvm_data/$ver/lib/node_modules/npm/man
And to remove it:
set --local man_index (contains --index -- $nvm_data/$ver/lib/node_modules/npm/man $MANPATH) &&
set --erase MANPATH[$man_index]
Related: https://github.com/fish-shell/fish-shell/issues/2090.
In short: Have a look at https://github.com/fish-shell/fish-shell/blob/a9708367db7bd15f28802c12ac947c2e354a98ea/share/functions/man.fish#L11-L29.
breaks man for other commands after updating $MANPATH
The usual case is that $MANPATH is unset, in which case man
will use the system's default.
Once you set it, only that will be used.
How you get it to use your directory in addition to the system path unfortunately depends on your man implementation (man is extremely unstandardized - there are a ton of implementations, and they work differently).
Common ideas are:
man -p
option or a manpath
program that can print the default (common on BSDs)This is down to man
, not fish.
It does not seem like there is currently support for man pages. For example, running
man npm
should pull up the man page for thenpm
command and all the other globally-installed npm packages that include man pages. It currently works for thenode
command, but notnpm
. I think that should be the responsibility of this script, but I might be wrong.If this is something that should be set by the user in a
config.fish
file orDockerfile
, let me know, and we can close this. I just think it would be convenient for this script to handle that. You can check out thisconfig.fish
I wrote a really long time ago that accounted for this (used this before using nvm at all).See: https://docs.npmjs.com/cli/v8/configuring-npm/folders#man-pages