Coder
Coder

Reputation: 1375

Can't find a way to disable line wrapping in MSysGit for commit messages vi/vim (by default around 74 chars)

I have tried a few times in the past (googling and trying things) to disable the small 74 character default line/word wrapping settings in MSysGit. I tried looking through the vim directories under msysgit, my windows user directory for settings, nothing. I can't find any documentation to disable this.

I'm using 1.7.11.msysgit.1

How do i turn off the line wrapping/word wrapping completely or at least increase the characters it wraps at to something really large.

Upvotes: 2

Views: 1128

Answers (2)

Coder
Coder

Reputation: 1375

Ok i figured it out. For anybody else interested in this, edit the file: [git]\share\vim\vimrc

and in the line below, change the 74 to your desired width. It's not perfect (it will still force a line wrap after the set characters if you ever reach them) but it's at least somewhat customizable. Maybe removing it will work better.

autocmd Syntax gitcommit setlocal textwidth=74

Upvotes: 2

bcelary
bcelary

Reputation: 1837

I think you should avoid messing with Vim's system settings. This is especially the case if you are on a Linux/Unix system with no admin rights and this issue is also a problem for you (I got this same behaviour on Linux). You should modify your vimrc file instead.

To find out where is the vim's vimrc file, issue :version command in vim and scroll down until you see the user vimrc file:. This is it.

Modify it to change the textwidth only:

autocmd Syntax gitcommit setlocal textwidth=0

which should disable automatic text wrapping at 74th character. You can also remove all the auto commands with:

autocmd! Syntax gitcommit

To see what are the actual commands before removing them, issue the above command without exclamation mark.

Upvotes: 7

Related Questions