,
git diff --word-diffの単語区切り文字として追加するにはどうすればよいですか?
たとえば、diffにそれを認識させたい
function(A,B,C) -> function(A, B, C)
行全体を置き換えるのではなく、スペースを追加しただけです。
使用--word-diff-regex
:
--word-diff-regex=<regex>
Use <regex> to decide what a word is, instead of considering runs
of non-whitespace to be a word. Also implies --word-diff unless it
was already enabled.
Every non-overlapping match of the <regex> is considered a word.
Anything between these matches is considered whitespace and
ignored(!) for the purposes of finding differences. You may want to
append |[^[:space:]] to your regular expression to make sure that
it matches all non-whitespace characters. A match that contains a
newline is silently truncated(!) at the newline.
The regex can also be set via a diff driver or configuration
option, see gitattributes(1) or git-config(1). Giving it explicitly
overrides any diff driver or configuration setting. Diff drivers
override configuration settings.
私はそれを使用したことはありませんが、それgit diff --word-diff-regex="[^[:space:],]+"
はうまくいくと思います。
KurzedMetal の回答に加えて、TAB を押しても bash のオートコンプリートが中断されないため、引用符がないとさらにうまく機能します。
git diff --word-diff-regex=[^[:space:],]+