Updated: 22 October 2026 · Applies to: vim, Python's built-in pydoc, and the Jedi-vim plugin

Option 1: pydoc, with no plugin required

pydoc shows help for any Python keyword, function or module from the command line:

pydoc keyword
pydoc3 keyword
pydoc len
pydoc print

To look up the word under the cursor directly from vim, edit ~/.vimrc:

vim ~/.vimrc

Add a mapping for the H key, for Python 3's pydoc3, that works in normal mode:

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

Save the file, then open a Python file:

vim file.py

With a little test content such as:

#!/usr/bin/python3
x = 5
y = 10
z = x + y
print(z)
print("Hello world")

Put the cursor on the word print and press Shift+H to see its pydoc3 help.

Option 2: Jedi-vim, with Shift+K

Jedi-vim is a vim binding for the Jedi autocompletion library. One of the things it adds is help for the keyword under the cursor when you press Shift+K.

Installing Jedi-vim

Install it with a plugin manager such as vim-plug: add this line to ~/.vimrc,

Plug 'davidhalter/jedi-vim'

save the file, open vim and run:

:PlugInstall

Or install it as a system package where your distribution provides one:

sudo pacman -S vim-jedi
sudo apt install vim-python-jedi
sudo dnf install vim-jedi

Jedi-vim works automatically once installed, with no further configuration needed. Press Shift+K on a keyword to see a popup with its documentation.

Related services

KVM VPS hosting

NVMe SSD and full root access, with Free Basic Managed Support.

Unmanaged dedicated servers

full root access and free IPMI KVM, with Free Basic Managed Support.

Managed dedicated servers

our engineers look after the server for you, from $135 a month.

Was this answer helpful?

Still stuck? Open a ticket