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. 回答1: Add this to your .vimrc : au FileType gitcommit setlocal tw=72 回答2: While the other answers solve this problem perfectly well, I highly recommend you install Tim Pope's fugitive.vim. fugitive.vim is an