Re: [RFC PATCH] make diff --color-words customizable
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Jan 9, 2009, 00:25 UTC
- Message-ID
- <alpine.DEB.1.00.0901090121432.30769@pacific.mpi-cbg.de>
- In-Reply-To
- <1231459505-14395-1-git-send-email-trast@student.ethz.ch>
Hi,
On Fri, 9 Jan 2009, Thomas Rast wrote:
Show 14 quoted lines
> Allows for user-configurable word splits when using --color-words. This
> can make the diff more readable if the regex is configured according to
> the language of the file.
>
> For now the (POSIX extended) regex must be set via the environment
> GIT_DIFF_WORDS_REGEX. Each (non-overlapping) match of the regex is
> considered a word. Anything characters not matched are considered
> whitespace. For example, for C try
>
> GIT_DIFF_WORDS_REGEX='[0-9]+|[a-zA-Z_][a-zA-Z0-9_]*|(\+|-|&|\|){1,2}|\S'
>
> and for TeX try
>
> GIT_DIFF_WORDS_REGEX='\\[a-zA-Z@]+ *|\{|\}|\\.|[^\{} [:space:]]+'Interesting idea. However, I think it would be better to do the opposite, have _word_ patterns. And even better to have _one_ pattern.
Then we could have a --color-words-regex=<regex> option.
BTW I think you could do what you intended to do with a _way_ smaller and more intuitive patch.
Ciao, Dscho