4

How can I use diff-so-fancy in magit rather than magit-delta?

I'd like to refine diff buffer in Emacs with magit. I found diff-so-fancy and prefer it to delta for several reasons.

I installed diff-so-fancy but magit didn't show diff formatted by diff-so-fancy but Terminal does by git diff.

3
  • I agree with @phils that is unlikely that magit could support it directly. What is it exactly that you are wanting it to use? The colors? (can certainly be fixed) The file headers? (could probably be fixed as well with some hacking). Commented Feb 10, 2022 at 1:19
  • Like this image, I mainly want to emphasize word level difference. diff-so-fancy image I just found magit-diff-refine-hunk satisfies my needs but it seems buggy like this image.
    – Ramiro
    Commented Feb 10, 2022 at 8:17
  • I had turned on magit-diff-refine-hunk so long ago I forgot it wasn't the default. :) Commented Feb 11, 2022 at 5:23

3 Answers 3

1

I can't imagine that being an option -- how could Magit understand the output of some arbitrary visualiser? It needs standard diffs to work with (whereas in your terminal you're getting read-only content, so it doesn't matter).

4
  • n.b. I don't know for certain, though; I'm sure someone will correct me if there's support for this.
    – phils
    Commented Feb 7, 2022 at 21:53
  • Thanks for commenting. magit-delta does that. And I just found magit-diff-refine-hunk basically satisfies my needs.
    – Ramiro
    Commented Feb 10, 2022 at 8:20
  • I didn't realize magit-delta was a package. Perhaps you can just change magit-delta-delta-executable and magit-delta-delta-args. If they both use ANSI escape sequence (which I assume they must), then perhaps magit-delta will do the rest. You might also have to add advice to magit-delta--make-delta-args to prevent it from adding --theme. Commented Feb 11, 2022 at 5:23
  • Thanks for your suggestion. That made me clear how to custom magit-delta code!
    – Ramiro
    Commented Feb 11, 2022 at 12:23
1

delta has a diff-so-fancy emulation mode via --diff-so-fancy or the delta.diff-so-fancy git config option.

1

I've created a package to display diff's using 3rd party tools, see: diff-ansi.

While it's not magic spesific, there is an option to use the package when displaying diff's in magit.

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.