Skip to content

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

pydoc.nvim

Open Python package documentation from Neovim.

Place cursor on any third-party symbol (function, class, module) and run :PydocOpen or press <leader>pd. The plugin uses the LSP to resolve which package the symbol belongs to, then opens its documentation URL in your browser.

Features

  • LSP-aware — queries textDocument/definition to find the package even when cursor is on a member (e.g. requests.get())
  • Falls back to <cword> — works without an LSP client
  • Resolves import-name mismatches — handles cases like PILpillow, dateutilpython-dateutil
  • Command completion:PydocOpen <Tab> lists installed packages
  • Customizable Python — configure the Python interpreter via setup()

Usage

:PydocOpen               Open docs for symbol under cursor
:PydocOpen requests      Open docs for a specific package
<leader>pd               Normal mode mapping (same as :PydocOpen)

Requirements

  • Neovim ≥ 0.7 (for nvim_create_user_command)
  • Python ≥ 3.8 (for importlib.metadata)
  • LSP client for Python (optional, for LSP-based resolution)

Installation

lazy.nvim:

{
  dir = '/path/to/pydoc.nvim',
  config = function()
    require('pydoc').setup({ python_cmd = 'python3' })
  end,
}

Configuration

require('pydoc').setup({
  python_cmd = 'python3',   -- Python interpreter command
  fallback = true,          -- fall back to Home-page if no Project-URL
})

How it works

  1. Resolve the package name (LSP definition path → site-packages directory → top-level name)
  2. Query Python's importlib.metadata for Project-URL: Documentation
  3. Fall back to Home-page if no Documentation URL is found
  4. Open the URL with vim.ui.open or xdg-open

This plugin was generated by AI (Anthropic Claude).

About

Neovim plugin to quickly access python documentation

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages