-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature: Wrap commit body at 72 characters #2627
Comments
Wrapping lines automatically is not a good idea, I think. This might work for simple paragraphs, but we often have commit messages containing e.g. markdown bullet point lists or other "half-formatted" text, and it's very hard to come up with an automatic wrapping algorithm that doesn't mess these up. A git hook to reject long lines is good, we have one at work. What I usually do is "commit with editor" and then use whatever wrapping functionality is built in to the editor I'm using (e.g. Alt-Q on emacs). I don't think it's worth adding such functionality to lazygit's commit editor; it will never be nearly as powerful as a dedicated text editor. It might, however, be useful to do something simple and draw a ruler at 72 characters so that you can see how long the lines are allowed to be. It would have to be configurable though, I want it at 80. 😄 |
I like the idea of a ruler. I suspect it would be pretty straight-forward to implement |
I would have no idea how to go about it, to be honest. Any pointers? |
Just pointing out that a PR was in the works for something like that. |
This issue should probably be split into add a marker at X characters and wrap commit body at X characters, the sentiment appears to be that warping should be closed a won't fix or help wanted. That way they don't overlap |
WrappingIt would also be nice to have an option we can set that will simply wrap the message where the box ends. It will still commit a long line, but the box itself will wrap. That way I can see my entire message. ⬆️ you can see I can't really see what I typed. Ideally it would wrap the word, but the character would also be fine. Again, the commit message here in the reflog would be:
...without a break. RulersI also think Ruler settings would also be appropriate, we would need 2 (or more?): One for subject, and one for the description. |
I don't think this is desirable. It would encourage people to create commit messages with long lines, which is not a good idea. Commit messages should really be hard-wrapped so that they are readable on any git client.
The subject already has a count for how many characters have been typed so far, so I don't think it needs a ruler. Only the body does. |
In line with @stefanhaller's and @aubreypwd's comments, I think a rule at column 72 is probably ideal as a first step, but I'd take a column count too. I've used git UIs that fool the user into thinking they hard-wrap, only later to discover commit messages which are unreadable in other tooling. So it's nice that lazygit is "WYSIWYG". OTOH, it's also annoying that there's zero formatting support, especially in projects that use hooks to enforce formatting rules. Once there's a column indicator, niceties like auto-word wrap at the end column could be added on top later. |
I disagree now. I know I argued for a ruler before, and against automatic wrapping, but I changed my mind. I started working on automatic wrapping-as-you-type (as shown here), and I won't settle for less now. 😄 For me this is the perfect solution. We shouldn't have to do any manual interactions for wrapping our text to a certain width. You don't do that when typing a paragraph in Word, either. I hope to have something working that can be tested soon. |
Ganbatte! |
Here's a draft PR: #3173. I'm very interested in feedback. |
Fixed by #3173. |
Is your feature request related to a problem? Please describe.
I recently had some issues where I had to amend commits because their format was wrong; it was expected for the body to wrap at 72 characters.
Describe the solution you'd like
I would like the body of a multiline commit to warp at 72 characters.
Describe alternatives you've considered
Additional context
The text was updated successfully, but these errors were encountered: