Re: [PATCH] colored diff.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Junio,

* Junio C Hamano <junkio@xxxxxxx> [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
-
: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]