Skip to content

Instantly share code, notes, and snippets.

@dfevre
Last active March 25, 2021 20:17
Show Gist options
  • Save dfevre/d9db90581a70878db03613045411b3e9 to your computer and use it in GitHub Desktop.
Save dfevre/d9db90581a70878db03613045411b3e9 to your computer and use it in GitHub Desktop.
A settings file for Sublime Text to help format git commit messages with subject headings and line wrapping.
// This is the settings file for git commit messages in Sublime Text inspired by http://chris.beams.io/posts/git-commit/.
// These settings will help assist in formatting git commit messages with the following -
// * Subject lines should be no more than 50 characters.
// * Other lines should wrap at 72 characters.
//
// It makes use of the AutoWrap package (https://github.com/randy3k/AutoWrap) to hard wrap lines.
//
// These settings put vertical rulers ar 50 chars and 72 chars and will hard wrap at 72 chars.
// These settings will only affect git commit messages because it is a syntax specific settings file.
//
// Follow these instructions to make it work -
// 1. Open Sublime Text.
// 2. Open a new file.
// 3. Change the syntax for the file to git commit by going to the bottom-right and selecting -
// Git -> Git Commit Message.
// 4. Now go to the menu and select -
// Sublime Text -> Preferences -> Settings - More -> Syntax Specific - User
// 5. A file will open called Git Commit Messag.sublime-settings. Copy and paste the contents of this file into it and save.
//
// Now you'll need to make Sublime Text your default editor for git commits.
// 1. Open terminal and type -
// git config --global core.editor "/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl -n -w"
//
// Your path to the Sublime Text app might be different and you might even be able to just use `subl -n -w` without a path.
{
"auto_wrap" : true,
"auto_wrap_width": 72,
"rulers": [50,72]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment