current setup
My .gitconfig
currently includes this alias:
[alias]
wdiff = diff --color-words --histogram
to let me write git wdiff
and get word-by-word rather than line-by-line diff
output. I use this for writing scholarly prose in LaTeX.
goal
This method divides words only at white space. I would like to divide at punctuation marks so that, for example, last word of sentence.
changed to last word of sentence.\footnote{New footnote.}
produces diff
output that looks something like this:
last word of sentence.\footnote{New footnote.}
rather than the current output:
last word of sentence.sentence.\footnote{New footnote.}
(where italics means deletion and bold means addition).
attempted solution
I found this other question that begins with a regex that does exactly what I want in the command line, but I haven't figured out how to put this in my .gitconfig
file without producing the error message fatal: bad config line 12 in file /Users/alex/.gitconfig
. This is what I put in my .gitconfig
file:
[alias]
wdiff = diff --color-words='[^][<>()\{},.;:?/|\\=+*&^%$#@!~`"'\''[:space:]]+|[][<>(){},.;:?/|\\=+*&^%$#@!~`"'\'']' --histogram
The problem seems to be the semicolon.
A different question that deals with a similar problem in .gitconfig
suggested putting double-quotes around an entire alias. But when I do that in my case, I get the same error message. I think this is because the regex also includes double-quotes.
question
How can I put the regex into my .gitconfig
file such that it can be properly parsed?