Sublime Text line wrap and commit messages

1.7k views Asked by At

I use Sublime Text (3) for my default Git commit message editor. I try to follow Git conventions using a hard limit on the number of characters per line (50 for the first line and 72 for the rest). I currently have guides set up at those intervals for visual reference, however rather than manually having to put a line return at the end of 72 characters, I would love to have ST automatically insert a line return for me. Essentially, I want to be able to write without line returns, but have actual returns put in for wrapping instead of just visually wrapping in the editor. Is there a reasonable way to do this?

1

There are 1 answers

5
RedBassett On BEST ANSWER

There is a useful plugin for this (that I somehow missed in prior searches) called AutoWrap. AutoWrap does exactly what I wanted and automatically wraps the line after a certain number of characters with a line return, and the settings for activating it and the number of characters can be set by syntax type. Here is my associated Git Commit Message.sublime-settings file (from Packages/User):

{
  "rulers": [50, 70],
  "spell_check": true,
  "auto_wrap": true,
  "auto_wrap_width": 70
}

The auto_wrap and auto_wrap_width lines work perfectly with the plugin and I can keep or remove the rulers as need be.