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.
Asked
Active
Viewed 1,971 times
5
1 Answers
9
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.
Eric O. Lebigot
- 158
- 8
Tommy A
- 6,770
- 22
- 36
npis 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. – zondo May 08 '16 at 01:28:!pydoc numpy.array– zondo May 08 '16 at 02:41:help :!from within Vim. You might also findman pydocfrom the terminal to be interesting. – zondo May 08 '16 at 02:51