9

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?

3
  • 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
    Commented Aug 6, 2015 at 22:45
  • @erikstokes: magit currently can't use it, but see magit-diff-refine-hunk for something similar.
    – npostavs
    Commented Aug 7, 2015 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
    Commented Aug 9, 2015 at 14:26

1 Answer 1

12

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.
1
  • 3
    Also M-x magit-diff-toggle-refine-hunk bound to D t (i.e. via magit-diff-refresh-popup) in Magit 2.
    – phils
    Commented Aug 11, 2015 at 2:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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