A lightweight Neovim plugin that formats code by calculating minimal diffs to preserve extmarks, folds, and viewport stability.
conform.nvim is a Neovim plugin that formats source code by calculating minimal diffs instead of replacing entire buffers. It solves the problem of formatting disrupting the editor state—such as clobbering extmarks, folds, and causing viewport jumps—by applying changes precisely where needed. It works with a wide array of external formatters and integrates with LSP formatting.
Neovim users who want reliable, non-disruptive code formatting that preserves their editing context, especially those using LSP servers or multiple formatters per filetype.
Developers choose conform.nvim because it uniquely maintains editor stability during formatting, fixes misbehaving LSP formatters, and adds range formatting to tools that lack it, all through a simple and familiar API.
Lightweight yet powerful formatter plugin for Neovim
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Calculates and applies only necessary changes using LSP utilities, preserving extmarks, folds, and cursor position to prevent viewport jumps, as detailed in the README's features.
Intercepts and corrects LSP servers that replace entire buffers, turning them into piecewise edits to avoid clobbering editor state, explicitly mentioned in the README.
Enables range formatting for any formatter, even those lacking native support, by computing minimal diffs, as explained in the advanced topics section.
Provides an imperative API modeled after vim.lsp.buf.format(), making integration straightforward for existing Neovim workflows, with examples in the setup guide.
Cannot run LSP commands or code actions as formatters, a admitted limitation in the FAQ, which restricts integration with some LSP-based fixing tools.
Requires Neovim 0.10 or higher, forcing users on older versions to downgrade or miss out, with no built-in fallback for compatibility.
Relies entirely on external formatter executables being installed and configured, which adds setup complexity and potential points of failure, as noted in the formatters list.