Skip to content

A simple Vim configuration that helps you write well structured, formatted git commit messages.

License

Notifications You must be signed in to change notification settings

jezsung/gitcommit-vimrc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

gitcommit-vimrc

A minimal Vim configuration that enforces git commit message best practices.

  • 50 character subject line - Automatically truncates the first line to 50 characters
  • Blank second line - Enforces a blank line between subject and body
  • 72 character body - Wrap text width to 72 with a visual column guide at 73
  • Spell checking - Enables English spell checking for commit messages

Demo

Setup

1. Set Vim as your git editor

git config --global core.editor "vim"

2. Download the configuration

New to Vim

If you don't have a ~/.vimrc file yet, follow these instructions. This will create a new Vim configuration file for you.

curl -fsSL https://raw.githubusercontent.com/jezsung/gitcommit-vimrc/main/.vimrc -o ~/.vimrc

Existing Vim configuration

If you already have a ~/.vimrc file with your own customizations, follow these instructions. This will add the git commit settings to your existing configuration without overwriting it.

Download this Vim configuration:

curl -fsSL https://raw.githubusercontent.com/jezsung/gitcommit-vimrc/main/.vimrc -o ~/.gitcommit.vim

Then add the source line to your existing ~/.vimrc:

echo 'source ~/.gitcommit.vim' >> ~/.vimrc

Usage

Run git commit in your terminal. Vim will automatically detect the commit message file and apply this configuration. You'll immediately benefit from:

  • Subject line truncation at 50 characters
  • Automatic blank second line enforcement
  • Text wrapping at 72 characters with a visual guide
  • Spell checking for your commit messages

No additional commands or setup required.

About

A simple Vim configuration that helps you write well structured, formatted git commit messages.

Topics

Resources

License

Stars

Watchers

Forks