Skip to contentSkip to conversation

commit message columns

DISCUSSION J. Bruce Fields 5 participants 6 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

Uh, I feel like I must be missing something simple here--when editing commit messages, you'd like the editor (vim in my case) to wrap text sooner than it normally would, since commit messages are displayed indented. What's the easiest way to ensure this always happens?

--b.

#1 lore raw

Hi,

Quoted 4 lines · J. Bruce Fields

Uh, I feel like I must be missing something simple here--when editing commit messages, you'd like the editor (vim in my case) to wrap text sooner than it normally would, since commit messages are displayed indented. What's the easiest way to ensure this always happens?

vim -c 'set tw=60'

where 60 is the column width. dont know how useful that is to you though

Jimmy.

Signature · 4 lines
Jimmy Tang
Trinity Centre for High Performance Computing,
Lloyd Building, Trinity College Dublin, Dublin 2, Ireland.
http://www.tchpc.tcd.ie/ | http://www.tchpc.tcd.ie/~jtang
#2 lore raw
Quoted 11 lines · Jimmy Tang

Hi,

Quoted 4 lines · J. Bruce Fields

Uh, I feel like I must be missing something simple here--when editing commit messages, you'd like the editor (vim in my case) to wrap text sooner than it normally would, since commit messages are displayed indented. What's the easiest way to ensure this always happens?

vim -c 'set tw=60'

where 60 is the column width. dont know how useful that is to you though

I was trying to figure out how to get that for git's invocations of vim, but not all others.

But, come to think of it, maybe I'd rather have the textwidth just be 72 everywhere.

--b.

#3 lore raw
In reply to J. Bruce Fields
Quoted 4 lines · J. Bruce Fields

Uh, I feel like I must be missing something simple here--when editing commit messages, you'd like the editor (vim in my case) to wrap text sooner than it normally would, since commit messages are displayed indented. What's the easiest way to ensure this always happens?

<shameless-plug>
Use git-gui. The message buffer window doesn't linewrap nor does it scroll, so you learn to linewrap on your own. :-) </shameless-plug>

When I'm not in git-gui I use vile and have a macro in it to pass the current paragraph of text through:

  fmt --crown-margin --width=70 --uniform-spacing

works reasonably well.

Signature · 1 line
Shawn.
#4 lore raw
In reply to J. Bruce Fields
Quoted 4 lines · J. Bruce Fields

Uh, I feel like I must be missing something simple here--when editing commit messages, you'd like the editor (vim in my case) to wrap text sooner than it normally would, since commit messages are displayed indented. What's the easiest way to ensure this always happens?

You could add this to your .vimrc:

Quoted 1 line

autocmd BufNewFile,BufRead .git/COMMIT_EDITMSG setlocal tw=60 ft=human

Has anyone a good filetype for this?

#5 lore raw
Quoted 3 lines · Matthias Lederhofer

You could add this to your .vimrc:

Quoted 1 line

autocmd BufNewFile,BufRead .git/COMMIT_EDITMSG setlocal tw=60 ft=human

Has anyone a good filetype for this?

I do the same thing, but I use filetype=gitcommit. Then it picks up the syntax highlighting file automatically (see contrib/vim).

-Peff