How to Use VimR as git difftool / mergetool

Tae Won Ha
1 min readOct 16, 2017

--

By installing the bundled command line tool vimr, you can use VimR as your git difftool and/or git mergetool.

VimR as git difftool

To do so, install the command line tool into your $PATH by using the “Copy ‘vimr’ CLI Tool…” button in the General preferences and add the following to ~/.gitconfig

[diff]
tool = vimrdiff
[difftool "vimrdiff"]
cmd = vimr --nvim --wait -d $LOCAL $REMOTE
[merge]
tool = vimrdiff
[mergetool "vimrdiff"]
cmd = vimr --nvim --wait -d $BASE $LOCAL $REMOTE $MERGED -c '$wincmd w' -c 'wincmd J'

Now, if you use git difftool or git mergetool, VimR will open. If you want to return to Terminal after closing the VimR window, you can set “After Last Window Closes” to “Hide” in the General preferences. Oh, and ctrl-w = could be useful to make the vertical splits equally wide.

--

--