Skip to content

Commit b83f99c

Browse files
L3n41cgitster
authored andcommitted
grep: align default colors with GNU grep ones
git-grep shares a lot of options with the standard grep tool. Like GNU grep, it has coloring options to highlight the matching text. And like it, it has options to customize the various colored parts. This patch updates the default git-grep colors to make them match the GNU grep default ones [1]. It was possible to get the same result by setting the various `color.grep.<slot>` options, but this patch makes `git grep --color` share the same color scheme as `grep --color` by default without any user configuration. [1] https://www.man7.org/linux/man-pages/man1/grep.1.html#ENVIRONMENT Signed-off-by: Lénaïc Huard <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 69a9c10 commit b83f99c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

grep.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ static struct grep_opt grep_defaults = {
2626
.pattern_type_option = GREP_PATTERN_TYPE_UNSPECIFIED,
2727
.colors = {
2828
[GREP_COLOR_CONTEXT] = "",
29-
[GREP_COLOR_FILENAME] = "",
29+
[GREP_COLOR_FILENAME] = GIT_COLOR_MAGENTA,
3030
[GREP_COLOR_FUNCTION] = "",
31-
[GREP_COLOR_LINENO] = "",
32-
[GREP_COLOR_COLUMNNO] = "",
31+
[GREP_COLOR_LINENO] = GIT_COLOR_GREEN,
32+
[GREP_COLOR_COLUMNNO] = GIT_COLOR_GREEN,
3333
[GREP_COLOR_MATCH_CONTEXT] = GIT_COLOR_BOLD_RED,
3434
[GREP_COLOR_MATCH_SELECTED] = GIT_COLOR_BOLD_RED,
3535
[GREP_COLOR_SELECTED] = "",

0 commit comments

Comments
 (0)