Jump to every concrete implementation of a Python abstract method — straight from your cursor.
Place your cursor on any @abstractmethod inside an ABC class and run :PyGTI. The plugin scans your project, finds all classes that implement that method, and sends them to the quickfix list (or an fzf-lua picker) so you can navigate there instantly.
- Detects abstract methods decorated with
@abstractmethodor@abc.abstractmethod - Handles all common ABC inheritance styles:
class Foo(ABC):class Foo(abc.ABC):class Foo(Generic[T], abc.ABC):— multiple bases, generics included
- Finds concrete implementations even when they inherit with a type parameter filled in:
class SqlRepo(Repo[ConcreteType]): - Works with multi-line method signatures — cursor can be on the
defline or any parameter line - Respects
.gitignorewhen scanning for Python files - Two display modes: native quickfix list or fzf-lua (with live file preview)
- Neovim ≥ 0.10
- nvim-treesitter with the Python parser installed
- plenary.nvim
- (optional) fzf-lua for the fuzzy-picker display mode
{
"sigfriedCub1990/nvim.py_gti",
dependencies = {
"nvim-treesitter/nvim-treesitter",
"nvim-lua/plenary.nvim",
},
opts = {},
}With fzf-lua as the picker:
{
"sigfriedCub1990/nvim.py_gti",
dependencies = {
"nvim-treesitter/nvim-treesitter",
"nvim-lua/plenary.nvim",
"ibhagwan/fzf-lua",
},
opts = {
picker = "fzf-lua",
},
}- Open a Python file and place your cursor on an abstract method:
class BusinessOfferRepository(Generic[OfferType], abc.ABC):
@abc.abstractmethod
def find(self, center_code: str) -> OfferType: ...
# ^ cursor anywhere here-
Run
:PyGTIor press<leader>gi(default keymap). -
Every class in your project that implements
findopens in the quickfix list (or fzf-lua picker). Press<CR>to jump.
Pass options to setup() (or via opts in lazy.nvim):
require("py_gti").setup({
-- Keymap to trigger :PyGTI. Set to "" to disable.
default_keymap = "<leader>gi",
-- Skip files listed in .gitignore when scanning the project.
respect_gitignore = true,
-- Skip files larger than this size (bytes).
max_filesize = 1024 * 1024, -- 1 MB
-- Display mode: "quickfix" (default) or "fzf-lua".
picker = "quickfix",
})When picker = "fzf-lua", results open in an fzf-lua window with:
- Syntax-highlighted file preview
<CR>to open,<C-s>to open in a horizontal split,<C-v>for vertical split
If fzf-lua is not installed the plugin falls back to quickfix automatically.
- Context detection — tree-sitter parses the current buffer and identifies the abstract method and its enclosing ABC class under the cursor.
- File discovery — walks upward from the current file to find the project root (
.git,pyproject.toml, orsetup.py), then enumerates all.pyfiles. - Implementation search — each file is parsed in-memory with tree-sitter (no buffers opened) to find classes that inherit from the ABC and define the method.
- Display — results are sent to the quickfix list or fzf-lua picker.
Run :checkhealth py_gti to verify your setup:
py_gti
OK Neovim >= 0.10
OK Python tree-sitter parser is available
OK plenary.nvim found
OK fzf-lua found (picker = "fzf-lua" available)
make docker-testRequires Docker. The image bundles the correct Neovim version, nvim-treesitter, and plenary so tests run the same way everywhere.