I tried python-mode, it seems that it can work when I press K on "numpy.array", but if I want to press K on "np.array", it won't work.
1 Answer
Try using the jedi-vim plugin. It uses Jedi to get completions and is much better at doing so than python-rope is. It will resolve np.array
to numpy.array
and show the appropriate documentation in a tab/split. Be warned that numpy is notoriously slow for Jedi to resolve when it's not cached.
zondo's suggestion to use :!pydoc numpy.array
does work, but I find it annoying because I can't use Vim mappings to navigate the output, yank text from it, or leave it open for reference. There's also the issue of using a virutalenv, which may not have pydoc
in the virtualenv's $PATH
. In that case, you would have to use: :!python -m pydoc numpy.array
.
np
is not the name of a module itself; it is a variable defined within the program to be another name for an already existing module. Therefore, you cannot find help on it without actually running the program.:!pydoc numpy.array
:help :!
from within Vim. You might also findman pydoc
from the terminal to be interesting.