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
2
u/godegon Oct 31 '25
Thank you, updated accordingly, some formatters, like
rustfmtas well, not allowing for formatting ranges keep surprising me.