Access python help using pydoc

The syntax is:

pydoc keyword
pydoc3 keyword
pydoc len
pydoc print

Edit your ~/.vimrc:

$ vim ~/.vimrc

Append the following configuration for pydoc3 (python v3.x docs). Create a mapping for H key that works in normal mode:

nnoremap <buffer> H :<C-u>execute "!pydoc3 " . expand("<cword>")<CR>

Save and close the file. Open vim text editor:

$ vim

Write some pre:


print("Hello world")

Position cursor under the print Python keyword and press "Shift" followed by "H". 

How to view python help when using vim

Jedi-vim is a VIM binding to the autocompletion library, Jed. It can do many things including display help for the keyword when you press "Shift" followed by "K" i.e. press capital "K".

How to install Jedi-vim on Linux or Unix-like system

Use pathogen, vim-plug or Vundle to install Jedi-vim. I am using Vim-Plug. Add the following line in ~/vimrc:

Plug 'davidhalter/jedi-vim'

Save and close the file. Start vim and type:


On Arch Linux, you can also install Jedi-vim from official repositories as vim-Jedi using pacman command:

$ sudo pacman -S vim-jedi

It is also available on Debian (?8) and Ubuntu (?14.04) as vim-python-Jedi using apt command/apt-get command:

$ sudo apt install vim-python-jedi

On Fedora Linux, it is available as vim-Jedi using dnf command:

$ sudo dnf install vim-jedi

Jedi is by default automatically initialized. So no further configuration needed on your part. To see Documentation/Pydoc press "K". It shows a popup with assignments:

Was this answer helpful? 0 Users Found This Useful (0 Votes)