diff options
author | Mark Lodato <lodatom@gmail.com> | 2010-03-07 11:52:46 -0500 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2010-03-08 00:30:44 -0800 |
commit | 55f638bdc6507b3a2ce03290741f592934afaee7 (patch) | |
tree | 8911c25a414e051bf235e5093e8d7229b0b5a9c6 /Documentation | |
parent | 758df17ab07a58e5b0f8effdf2d1b71fe8d79f1d (diff) | |
download | git-55f638bdc6507b3a2ce03290741f592934afaee7.tar.gz |
grep: Colorize filename, line number, and separator
Colorize the filename, line number, and separator in git grep output, as
GNU grep does. The colors are customizable through color.grep.<slot>.
The default is to only color the separator (in cyan), since this gives
the biggest legibility increase without overwhelming the user with
colors. GNU grep also defaults cyan for the separator, but defaults to
magenta for the filename and to green for the line number, as well.
There is one difference from GNU grep: When a binary file matches
without -a, GNU grep does not color the <file> in "Binary file <file>
matches", but we do.
Like GNU grep, if --null is given, the null separators are not colored.
For config.txt, use a a sub-list to describe the slots, rather than
a single paragraph with parentheses, since this is much more readable.
Remove the cast to int for `rm_eo - rm_so` since it is not necessary.
Signed-off-by: Mark Lodato <lodatom@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Documentation')
-rw-r--r-- | Documentation/config.txt | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/Documentation/config.txt b/Documentation/config.txt index 7103172ed3..d6e4a3e0cc 100644 --- a/Documentation/config.txt +++ b/Documentation/config.txt @@ -683,9 +683,23 @@ color.grep:: `never`), never. When set to `true` or `auto`, use color only when the output is written to the terminal. Defaults to `false`. -color.grep.match:: - Use customized color for matches. The value of this variable - may be specified as in color.branch.<slot>. +color.grep.<slot>:: + Use customized color for grep colorization. `<slot>` specifies which + part of the line to use the specified color, and is one of ++ +-- +`filename`;; + filename prefix (when not using `-h`) +`linenumber`;; + line number prefix (when using `-n`) +`match`;; + matching text +`separator`;; + separators between fields on a line (`:`, `-`, and `=`) + and between hunks (`--`) +-- ++ +The values of these variables may be specified as in color.branch.<slot>. color.interactive:: When set to `always`, always use colors for interactive prompts |