Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a good macvim git diff?

I have been using textmate for many years and I just made the switch to macvim and one thing that I used all the time with textmate was the command git df which in my .gitconfig was just an alias for

[alias]
    df = !git diff | mate 

and what that did was give me a screen like this

enter image description here

Is there a replacement in mvim that I can add somewhere for me to get similar behavior

like image 621
Matt Elhotiby Avatar asked Mar 15 '26 05:03

Matt Elhotiby


1 Answers

I describe what I use here.

Basically, add the following lines to your "~/.gitconfig":

[diff]
    tool = default-difftool

[difftool "default-difftool"]
    cmd = default-difftool.sh $LOCAL $REMOTE

With the following wrapper script:

#! /bin/bash

if [[ -f /Applications/MacVim.app/Contents/MacOS/Vim ]]
then
    # bypass mvim for speed
    VIMPATH='/Applications/MacVim.app/Contents/MacOS/Vim -g -dO -f'
elif [[ -f /usr/local/bin/mvim ]]
then
    # fall back to mvim
    VIMPATH='mvim -d -f'
else
    # fall back to original vim
    VIMPATH='vimdiff'
fi

$VIMPATH $@
like image 65
Jeet Avatar answered Mar 16 '26 17:03

Jeet



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!