nickcoxdotme
nickcoxdotme

Reputation: 6707

Vim not highlighting whitespace in git patch

I have followed the advice in this post for coloring white space in git diffs. However, I don't often use diffs, so this was helpful to me in something I do use often, git add -p, or patch mode. As of now, git will show me when I add a whitespace error. That is, it will highlight it on the end of a line. (I can't replicate this with a code example here because of the highlighting.) But when I remove a whitespace error, it looks like this:

-  def method_name
+  def method_name

Where there used to the a whitespace error on the end of the first line and it is deleted in the second. This isn't very helpful, because the lines look identical. So how can I get it to show the highlighting of a deleted whitespace error?

Note: I am using MacVim.

EDIT: The other issue is that if I try to git diff -R (reverse), then it looks like I added a whitespace error instead of removing it, and that's confusing.

Upvotes: 2

Views: 165

Answers (1)

Chronial
Chronial

Reputation: 70873

You can’t. All I have to offer are two mildly helpful tips:

  • Regarding git add: If you see something like the situation you mentioned and you did not mess with tabs, you can be sure that you removed whitespace at the end of the line.
  • Regarding git diff -R: Well, just remember that you are running -R :)

Upvotes: 1

Related Questions