The bundled vimrc script, when enabled, currently sets the text width to 80 characters for all files within the source directory. Unfortunately this means the setting also applies when editing .git/COMMIT_EDITMSG, overriding the default and standard text width of 72 for Git commit messages. (A text width of 80 is too much for commit messages because Git indents commit messages by four spaces when displaying them via e.g. git log, leading to a total displayed width of 84 characters.)
This patch explicitly sets the text width of Git commit messages to 72 characters in accordance with standard practice. (Alternatively we could avoid setting textwidth at all in this case and let the defaults kick in, but maybe it's better to be explicit?) Tested by writing up this commit message :) Is this OK to commit? contrib/ChangeLog: * vimrc: Reduce textwidth to 72 for Git commit messages. --- contrib/vimrc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/contrib/vimrc b/contrib/vimrc index fa0208d5beb..c207eead2e4 100644 --- a/contrib/vimrc +++ b/contrib/vimrc @@ -39,7 +39,11 @@ function! SetStyle() setlocal shiftwidth=2 setlocal noexpandtab endif - setlocal textwidth=80 + if &filetype == "gitcommit" + setlocal textwidth=72 + else + setlocal textwidth=80 + endif setlocal formatoptions-=ro formatoptions+=cqlt if index(l:c_exts, l:ext) != -1 setlocal cindent -- 2.26.2.266.ge870325ee8