Search code examples
gitvimword-wrapcommit-message

Automatically wrap long Git commit messages in Vim


Using Git, my editor for commits is Vim. I'm constantly doing a poor job of remembering to wrap lines and so I get long lines (see this answer for example). Is there a way using some git config or .vimrc magic that I can get Vim to automatically wrap lines at 72 columns?

Related question.


Solution

  • Add this to your .vimrc:

    au FileType gitcommit setlocal tw=72