I would like to have git diff
outputs me regular diffs for all files, except *.tex. For *.tex files, I would like to see the output of git diff --word-diff
.
I was playing around with .gitattributes
and .gitconfig
, but the furthest I got was to get a partial display for one .tex file, followed by a crash.
Is it possible to get this behaviour?
My .gitattributes
:
*.tex diff=latex
.gitconfig
:
[diff "latex"]
wordRegex = "\\\\[a-zA-Z]+|[{}]|\\\\.|[^\\{}[:space:]]+"
command = ~/bin/word-diff.sh
and word-diff.sh
:
#!/bin/sh
git --no-pager diff --color-words "$2" "$5"