git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Glanzmann <sithglan@stud.uni-erlangen.de>
To: Junio C Hamano <junkio@cox.net>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] colored diff.
Date: Thu, 20 Apr 2006 13:52:38 +0200	[thread overview]
Message-ID: <20060420115238.GA4681@cip.informatik.uni-erlangen.de> (raw)
In-Reply-To: <7vpsjczh1k.fsf@assigned-by-dhcp.cox.net>

Hello Junio,

* Junio C Hamano <junkio@cox.net> [060420 12:22]:
> With configuration option diff.usecolor, this colorizes the diff
> output.

I use a long time the following combination, which served me and a few
others very well:

        bourne shell function:

        BLACK="^[[0;30m"
        RED="^[[0;31m"
        GREEN="^[[0;32m"
        YELLO="^[[0;33m"
        BLUE="^[[0;34m"
        PURPLE="^[[0;35m"
        CYAN="^[[0;36m"
        WHITE="^[[0;37m"
        END="^[[0m"
        REVERSE="^[[7m"

        cdiff()
        {
                cat $1 | \
                sed -e " \
                        s/^\(diff-tree\)\(.*\)/\1${RED}\2${END}/; \
                        s/^+.*/$RED&$END/;  \
                        s/^-.*/$BLUE&$END/;  \
                        s/^@.*/$GREEN&$END/;  \
                        s/^Date.*/$RED&$END/;  \
                        s/^Author.*/$RED&$END/; \
                        " | less -R -i -p "^diff-tree"

                        # This would highlight manpages but the last line clashes with cdiff
                        # --tg 00:52 05-05-26
                        #s/^[A-Z]\+[A-Z ]\+$/$RED&$END/; \
                        #s/[A-Z]\+([0-9])/$RED&$END/g; \
                        # s/\W--\?[0-9a-zA-Z=-]\+/$BLUE&$END/g; \
        }

# with 'n' you simply jump to the next commit
# with 'N' to the previous

git-whatchanged -p | cdiff

screenshot: http://wwwcip.informatik.uni-erlangen.de/~sithglan/shot.png

Thanks for the enegery you put in git,
                                   Thomas

      reply	other threads:[~2006-04-20 11:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-20 10:18 [PATCH] colored diff Junio C Hamano
2006-04-20 11:52 ` Thomas Glanzmann [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=20060420115238.GA4681@cip.informatik.uni-erlangen.de \
    --to=sithglan@stud.uni-erlangen.de \
    --cc=git@vger.kernel.org \
    --cc=junkio@cox.net \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).