Just an example proposition born out of #16807 to use &formatprg when there is a standard formatter as is the case here instead of adding custom command that cannot operate on a text object and are rather unwieldy to use in comparison to gq. One can still fall back to gw if C style formatting is preferred.
https://github.com/vim/vim/pull/16946
(3 files)
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
NB: The repo listed as maintainer has been stale for the last three years
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
@Konfekt pushed 1 commit.
—
View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
But why deleting all the existing formatting code? If that is working, why change it?
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
@Konfekt pushed 2 commits.
You are receiving this because you are subscribed to this thread.![]()
I added it back. It seemed rather redundant and less code is easier to maintain, especially unmaintained one.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
I added it back. It seemed rather redundant and less code is easier to maintain, especially unmaintained one.
True, but
and given that there are no more changes in this PR, we can declare this fixed/closed/merged :)
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
Closed #16946.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
Oops, while resolving merge conflicts I accidentally removed the set-up &formatprg
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
Hi, are you sure this is a wise choice? It doesn't seem like rustfmt actually formats comments correctly—it doesn't wrap them at textwidth, and it also throws away any indentation before the comment leader (//). This pretty much breaks gq for me. Am I alone? What was the reason for changing it?
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
This pretty much breaks gq for me. Am I alone? What was the reason for changing it?
You're not alone
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
Thanks. I sent a pull request to revert the bad commit. How do I get a maintainer to look at it? I'm new here.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
Conclusion was that there's nothing to revert but simply use gw intended to that end while gq is intended to be used with &formatprg.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
Mind that you as a user can change a filetype's settings, such as formatprg as well, see :help filetype-plugin
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
Conclusion was that there's nothing to revert but simply use
gwintended to that end whilegqis intended to be used with&formatprg.
For that it should work with ranges, and @jacobsa says it doesn't. I don't use rust, so can't check it myself, but for me it is a no go if formatprg doesn't respect the range to be formatted.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
I agree, I just did not imagine
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
FWIW, I set formatprg=rustfmt myself for Rust. Like with {Black and Python} or {Go}, you have to format enough of the code for the formatter to understand it (so typically a full top-level definition). I don't see anything wrong with this, personally.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
Yes, I do the same for Modula-3 where the formatter has the same requirement.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
That is fine for personal setup, I prefer custom buffer local Fmt command for this but gqq is totally ok. However, for vim it should be able to work with stdin and process a range of lines to be set as formatprg.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
It does work with stdin and ranges. As @benknoble mentioned, you just have to pass it something sensible to format.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
It was the second complaint about a broken rustfmt as gq formatter so I am fine with rolling it back
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()