How to access/view Python help when using vim

Originally published at: https://www.cyberciti.biz/faq/how-to-access-view-python-help-when-using-vim/

I am a new Vim text editor user. I am writing Python code. Is there is a way to see Python documentation within vim and without visiting the Internet? Say my cursor is under the print Python keyword, and I press F1. I want to look at the help for the print keyword. How do…

Hello!

Please, keep in your mind that this functionality is built-in into Vim. More specifically, Vi was designed to read manual pages with the key K, and Vim extended it even further by allowing the user to override the manual program with the keywordprg option.

Actually, on my system (Debian/Ubuntu), Vim is already set up to open the pydoc every time I read documentation on a Python file:

:set keywordprg?
keywordprg=pydoc

It is quite possible the same bindings/settings to exist in other Linux distributions, as well.

Of course, more information can be obtain with Vim:

:help K
:help keywordprg