2

I am currently trying to edit a git hunk file (a diff: .git/addp-hunk-edit.diff), and to say to git that a line containing whitespace is unchanged it needs to have (a line with a single space) as its first character. The problem is that Vim removes all whitespace in otherwise empty lines as soon as I save the file!

This only happens on this file type, not for for instance .vimrc. How can I manually disable this behavior, and even better, permanently disable it for diff files?

  • MacVim 7.4.77, installed via Homebrew.
  • My .vimrc
oligofren
  • 1,093
  • 1
  • 8
  • 16

1 Answers1

6

Since there was nothing explicit in my .vimrc that acted on only-whitespace lines and the diff syntax file did no such thing either, this had to with my plugins somehow. I find out that I had an EditorConfig file in this project, and in it it had these lines:

[*]
# other
#stuff 
trim_trailing_whitespace = true

I then subsequently added a section for diff files

[*.diff]
trim_trailing_whitespace = false

and voila, everything works as intended :)

oligofren
  • 1,093
  • 1
  • 8
  • 16