10

I typeset my manuscript in org-mode with visual-line-mode turned on. Physically one of my paragraphs is just a line which is soft-wrapped.

In this case, when I tried to git diff (magit) to see what I have changed, all of this line (paragraph) is marked to be changed. I could not find out which part of this paragraph have been changed simply.

I think there should be some solutions regrading this issue, but I could not find any answer from website. Can anyone share your good solution?

  • The git command I use to deal with this is git diff --color-words. I don't know how to get magit to use that option. – erikstokes Aug 6 '15 at 22:45
  • @erikstokes: magit currently can't use it, but see magit-diff-refine-hunk for something similar. – npostavs Aug 7 '15 at 13:37
  • @npostavs Your comment is very useful. So if that is okay, i would like to ask you to answer this question for other's convenience. – Leu_Grady Aug 9 '15 at 14:26
11

You can customize/set magit-diff-refine-hunk to highlight word changes. magit-diff-toggle-refine-hunk, bound to D t, can be used to change it on the fly.

magit-diff-refine-hunk is a variable defined in `magit-diff.el'.

Whether to show word-granularity differences within diff hunks.

nil    never show fine differences.
t      show fine differences for the selected diff hunk only.
`all'  show fine differences for all displayed diff hunks.
  • 2
    Also M-x magit-diff-toggle-refine-hunk bound to D t (i.e. via magit-diff-refresh-popup) in Magit 2. – phils Aug 11 '15 at 2:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.