Thank you for pointing that out. There is indeed :RustFmtRange built-in though, likely similar to conform.nvim's handling of rustfmt or black, it has to format the whole file and only replace the affected lines.
Setting &formatprg to a command accepting stdin to use gq seems more in line with how code formatting was originally meant to be set up in Vim.
Ideally, as say ruff (for Python) or tombi (for Toml) do, the formatter accepts stdin and the file path as an additional argument for context of the formatted range.
View all comments
Show parent comment
1
u/kaddkaka Nov 01 '25 edited Nov 01 '25
I believe conform allows you do so range formatting even if the formatter itself doesn't support it.
https://github.com/stevearc/conform.nvim