2

I compare two version of Latex file, using vimdiff.

Lines in my file may contain as much as 30 sentences. The difference between the sentences are mostly small, like a typo, a word added or removed, word order reversed.

If a line differs between the two files, vimdiff marks the first word that differs plus the whole rest of the line in red in both files; this is too much, and additionally, makes it hard to spot differences, if present, in the marked text.

What can I do to spot these differences easier?

Is there a way to let vim diff compare files sentence by sentence instead of line by line?

Or is it possible to let vim diff mark only the words that differ within a line?

Marcus
  • 5,104
  • 2
  • 28
  • 24
sjdh
  • 3,907
  • 8
  • 25
  • 32

1 Answers1

3

There's a new plugin, diffchar.vim - Highlight the difference, character by character, which apparently provides this (haven't tried it yet). In general, diffing is line-based, so any content that does not have great granularity on a line level is problematic.

A workaround would be to temporarily modify both buffers (without persisting) to introduce more line breaks, and then :diffupdate. Based on your follow-up question, you seem to be thinking along the same lines.

Community
  • 1
  • 1
Ingo Karkat
  • 167,457
  • 16
  • 250
  • 324