Sublime Forum

Commit message: hard wrap

#1

Is there a way to configure sublime merge to insert a hard line wrap at the ruler?

Our commit message style guide is more or less matching the linux kernel one and that requires a hard line break at column 72.

Of the setttings offered in Commit Message.sublime-settings I can’t find anything to insert a hard wrap.

1 Like

#2

does setting "wrap_width": 72, help?

0 Likes

#3

it does wrap at the ruler, but it’s soft-warpping

0 Likes

#4

I don’t think there’s any way to do this currently. The commit editor works the same as editing in Text, which doesn’t do hard wrapping either.

The solution for that in Text is to use the wrap_lines command manually such as with Edit > Wrap > Wrap Paragraph at Cursor, but that command is not currently available in Merge because it’s implemented in Python and not in the core and there isn’t a plugin host yet (and so we can’t create a plugin to do it either).

I’ve been using "rulers": [50, 72] as a guide and wrapping manually for the time being.

0 Likes

#5

Sorry to necropost this thread, but has this issue been addressed in any way yet? This is pretty much my only pain point with Sublime Merge. When committing multi-paragraph commit messages I always switch to a different editor, as it’s a massive pain to “reflow” a paragraph if I make any changes to it. Are there perhaps any keyboard shortcuts available in Sublime Merge to reflow a paragraph of text?

0 Likes

#6

What about using a commit-msg hook? Works locally, can do controls beyond what SM can do, … (oh, and also work if, for whatever reason, you do a commit from the command line).

https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks

0 Likes

#7

There’s Edit > Wrap Paragraph to do this now where there wasn’t back when I made the post above; see the menu entry for the key binding associated with it, which should be the same as it is in Text.

In combination with the rulers setting for above, you can reflow a paragraph with a keypress or reflow the entire message with two (select all, then wrap).

0 Likes

#8

Oh nice, and it’s bound to Alt+Q by default… Too bad it wraps to the most restrictive ruler, which in a Git commit message editor is probably 50… I guess I’ll live without that ruler :slight_smile:

0 Likes

#9

It will wrap to the first ruler in the rulers key, so if you set your rulers to [70, 50] it will wrap at 70 but still let you have the other ruler for the first line. I swapped my setting to that from the above when this became available. :slight_smile:

0 Likes

#10

Man you are a SM wizard. Thanks!

0 Likes