All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Lénaïc Huard" <lenaic@lhuard.fr>
To: git@vger.kernel.org
Cc: "Junio C Hamano" <gitster@pobox.com>,
	"Martin Ågren" <martin.agren@gmail.com>,
	"Johannes Schindelin" <Johannes.Schindelin@gmx.de>,
	"Philippe Blain" <levraiphilippeblain@gmail.com>,
	"Lénaïc Huard" <lenaic@lhuard.fr>
Subject: [PATCH v2 1/1] grep: align default colors with GNU grep ones
Date: Wed,  5 Jan 2022 09:18:35 +0100	[thread overview]
Message-ID: <20220105081835.4949-2-lenaic@lhuard.fr> (raw)
In-Reply-To: <20220105081835.4949-1-lenaic@lhuard.fr>

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 <lenaic@lhuard.fr>
---
 grep.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/grep.c b/grep.c
index fe847a0111..ca4f321cb3 100644
--- a/grep.c
+++ b/grep.c
@@ -26,10 +26,10 @@ static struct grep_opt grep_defaults = {
 	.pattern_type_option = GREP_PATTERN_TYPE_UNSPECIFIED,
 	.colors = {
 		[GREP_COLOR_CONTEXT] = "",
-		[GREP_COLOR_FILENAME] = "",
+		[GREP_COLOR_FILENAME] = GIT_COLOR_MAGENTA,
 		[GREP_COLOR_FUNCTION] = "",
-		[GREP_COLOR_LINENO] = "",
-		[GREP_COLOR_COLUMNNO] = "",
+		[GREP_COLOR_LINENO] = GIT_COLOR_GREEN,
+		[GREP_COLOR_COLUMNNO] = GIT_COLOR_GREEN,
 		[GREP_COLOR_MATCH_CONTEXT] = GIT_COLOR_BOLD_RED,
 		[GREP_COLOR_MATCH_SELECTED] = GIT_COLOR_BOLD_RED,
 		[GREP_COLOR_SELECTED] = "",
-- 
2.34.1


      reply	other threads:[~2022-01-05  8:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-16 11:56 [PATCH 0/1] grep: align default colors with GNU grep ones Lénaïc Huard
2021-12-16 11:56 ` [PATCH 1/1] " Lénaïc Huard
2021-12-16 21:59 ` [PATCH 0/1] " Junio C Hamano
2022-01-03 22:40   ` Junio C Hamano
2022-01-05  8:21     ` Lénaïc Huard
2022-01-05  8:18 ` [PATCH v2 " Lénaïc Huard
2022-01-05  8:18   ` Lénaïc Huard [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220105081835.4949-2-lenaic@lhuard.fr \
    --to=lenaic@lhuard.fr \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=levraiphilippeblain@gmail.com \
    --cc=martin.agren@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.