finds.dev← search

// the find

ThePrimeagen/refactoring.nvim

★ 3,618 · Lua · MIT · updated Jun 2026

The Refactoring library based off the Refactoring book by Martin Fowler

A Neovim plugin that implements the core refactoring operations from Martin Fowler's book — extract function, inline variable, extract variable, inline function — using tree-sitter for AST awareness and LSP for cross-reference resolution. This is for Neovim power users who want IDE-grade refactoring without leaving the terminal.

The operator model is the right design choice: returning a motion operator means you get dot-repeat and textobject composition for free, which most Neovim plugins don't bother with. The LSP + tree-sitter split is clean — LSP handles references across files, tree-sitter handles scope and code structure, and neither is used for what the other is better at. The query-per-language approach in `./queries/` makes language support genuinely extensible without touching the Lua core. Test coverage is solid: before/after file pairs across a dozen languages, not just Lua.

Inline function is limited to single-return functions only, which rules out most real-world use cases — this isn't a minor edge case, it's the common case. No rename symbol, no move method, no extract interface — the four supported operations are useful but this covers maybe 20% of what Fowler's book actually describes. Requires Neovim 0.12, which as of mid-2026 is very recent and will break setups on stable distro packages. Language support is uneven: Go and Java are missing `refactor_comment` and `refactor_debug_path` queries, so the debug print features don't work there.

View on GitHub →

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →