Skip to content

Instantly share code, notes, and snippets.

@dansimau
Created July 13, 2012 10:39

Revisions

  1. dansimau revised this gist Jul 13, 2012. 1 changed file with 3 additions and 5 deletions.
    8 changes: 3 additions & 5 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -2,15 +2,13 @@

    ## Mac OS X

    Copy and paste these give easy commands:

    1. Install `colordiff` using Homebrew:

    brew install colordiff

    2. Add function to your `~/.bash_profile`:

    cat <<EOF >~/.bash_profile
    cat <<EOF >>~/.bash_profile

    function diff {
    colordiff -u "$@" | less -RF
    @@ -27,7 +25,7 @@ Copy and paste these give easy commands:

    4. Reload:

    . ~/.bash_profile
    . ~/.bash_profile



    @@ -39,4 +37,4 @@ Copy and paste these give easy commands:

    * `-u` in `diff` means: unified diff
    * `-R` in `less` means: show raw escape codes (so we can see the colour)
    * `-F` in `less` means: quit if entire output fits on one screen
    * `-F` in `less` means: quit if entire output fits on one screen
  2. dansimau created this gist Jul 13, 2012.
    42 changes: 42 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,42 @@
    # Enable git-style colour output in regular diff

    ## Mac OS X

    Copy and paste these give easy commands:

    1. Install `colordiff` using Homebrew:

    brew install colordiff

    2. Add function to your `~/.bash_profile`:

    cat <<EOF >~/.bash_profile

    function diff {
    colordiff -u "$@" | less -RF
    }
    EOF

    3. Change default output colours to match git:

    cat <<EOF >~/.colordiffrc
    newtext=green
    oldtext=red
    diffstuff=cyan
    EOF

    4. Reload:

    . ~/.bash_profile



    5. Profit.

    ---

    *Notes on switches:*

    * `-u` in `diff` means: unified diff
    * `-R` in `less` means: show raw escape codes (so we can see the colour)
    * `-F` in `less` means: quit if entire output fits on one screen