Access the complete Python official API documentation directly within your editor. Search, browse, and autocomplete Python API documentation using Vim's native :help
and :helpgrep
commands.
- Browse official Python API documentation without leaving your editor
- Search function signatures, example code, topics, tutorials, and howto guides
- Comprehensive tags database for precise documentation lookup
- High-quality documentation comparable to Dash or Zeal
- Full integration with Vim's help system
Demo uses vimsuggest for autocompletion.
- Vim or Neovim
Install via vim-plug, lazy or Vim's built-in package manager.
Show installation instructions
Add to your .vimrc
:
call plug#begin()
Plug 'girishji/pythondoc.vim'
call plug#end()
Using Neovim's Lazy
Add to your Lua config:
require("lazy").setup({
{ "girishji/pythondoc.vim", opts = {} },
})
git clone https://github.com/girishji/pythondoc.vim.git $HOME/.vim/pack/downloads/opt/pythondoc.vim
Then add this line to your vimrc file:
packadd vimsuggest
git clone https://github.com/girishji/pythondoc.vim.git %USERPROFILE%\vimfiles\pack\downloads\opt\pythondoc.vim
Then add this line to your vimrc file:
packadd vimsuggest
:help <tag> " Access all helpfiles (Python and Vim)
:Help <tag> " Python-specific documentation
- Enable shorthand
:h
command:
" In vimrc
let g:pythondoc_h_expand = 1
- Add keyboard shortcut for cursor word lookup:
" In ftplugin/python.vim
exe 'nnoremap <buffer> dK :<c-u>Help <c-r><c-w>'..nr2char(&wildcharm)
- Python tags include
@py
suffix in Vim (unlesshelplang
is set topy
) - Makes Python documentation easily distinguishable
- Format:
function()..topic.pyx
(Open the topic by typing:h topic.pyx
)
The help files are generated from the official Python repository using the official tool and extension.
Here are the steps to generate help files:
-
Setup:
# Clone repositories git clone https://github.com/girishji/pythondoc.vim mkdir tmp git clone https://github.com/python/cpython tmp/
-
Create Python Environment:
cd pythondoc.vim/tmp/cpython/Doc make venv
-
Configure Build:
- Add "vimbuilder" to
requirements.txt
- Set in conf.py:
vimhelp_filename_extension = 'pyx'
- Modify Doc/Makefile:
- Add 'vimhelp' target (similar to 'html' or 'text')
- Optional: Comment out Blurb/NEWS lines to avoid harmless errors
- Add "vimbuilder" to
-
Prepare Documentation:
- Rename howto/*.rst files: prepend 'howto-'
- Update references in (to reflect change of file name):
- howto/howto-index.rst
- content.rst
-
Generate Documentation:
make vimhelp cp build/vimhelp/{library,howto}/*.pyx _doc/doc/ vim "+helptags ./_doc/doc | q"
This plugin is maintained for personal use but aims to stay current with Python releases.