summaryrefslogtreecommitdiff
path: root/grep.h
diff options
context:
space:
mode:
authorMark Lodato <lodatom@gmail.com>2010-03-07 11:52:46 -0500
committerJunio C Hamano <gitster@pobox.com>2010-03-08 00:30:44 -0800
commit55f638bdc6507b3a2ce03290741f592934afaee7 (patch)
tree8911c25a414e051bf235e5093e8d7229b0b5a9c6 /grep.h
parent758df17ab07a58e5b0f8effdf2d1b71fe8d79f1d (diff)
downloadgit-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 'grep.h')
-rw-r--r--grep.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/grep.h b/grep.h
index 9703087996..36919ee217 100644
--- a/grep.h
+++ b/grep.h
@@ -84,7 +84,10 @@ struct grep_opt {
int color;
int max_depth;
int funcname;
+ char color_filename[COLOR_MAXLEN];
+ char color_lineno[COLOR_MAXLEN];
char color_match[COLOR_MAXLEN];
+ char color_sep[COLOR_MAXLEN];
int regflags;
unsigned pre_context;
unsigned post_context;