Skip to content

girishji/pythondoc.vim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pythondoc - Python Documentation Browser for Vim/Neovim

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.

Features

  • 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 Video

Demo uses vimsuggest for autocompletion.

Requirements

  • Vim or Neovim

Installation

Install via vim-plug, lazy or Vim's built-in package manager.

Show installation instructions

Using vim-plug

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 = {} },
})

Using Vim's built-in package manager

Linux

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

Windows

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

Basic Usage

Core Commands

:help <tag>     " Access all helpfiles (Python and Vim)
:Help <tag>     " Python-specific documentation

Quick Customization Guide

  1. Enable shorthand :h command:
" In vimrc
let g:pythondoc_h_expand = 1
  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)

Tag Format

  • Python tags include @py suffix in Vim (unless helplang is set to py)
  • Makes Python documentation easily distinguishable
  • Format: function()..topic.pyx (Open the topic by typing :h topic.pyx)

For Maintainers

The help files are generated from the official Python repository using the official tool and extension.

Here are the steps to generate help files:

  1. Setup:

    # Clone repositories
    git clone https://github.com/girishji/pythondoc.vim
    mkdir tmp
    git clone https://github.com/python/cpython tmp/
  2. Create Python Environment:

    cd pythondoc.vim/tmp/cpython/Doc
    make venv
  3. 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
  4. Prepare Documentation:

    • Rename howto/*.rst files: prepend 'howto-'
    • Update references in (to reflect change of file name):
      • howto/howto-index.rst
      • content.rst
  5. 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.

Releases

No releases published

Packages

No packages published