Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Use neovim as diff tool
[merge]
tool = vimdiff
[mergetool]
prompt = true
[mergetool "vimdiff"]
cmd = nvim -d $LOCAL $REMOTE $MERGED -c '$wincmd w' -c 'wincmd J'
[difftool]
prompt = false
[diff]
tool = vimdiff
@TamaMcGlinn

This comment has been minimized.

Copy link

@TamaMcGlinn TamaMcGlinn commented Nov 13, 2019

Why is the first wincmd with $ and the second without?

@farisachugthai

This comment has been minimized.

Copy link

@farisachugthai farisachugthai commented Dec 14, 2019

First one shouldnt have a "$" in case thats giving you problems. Otherwise this worked perfectly for me.

@IngoMeyer441

This comment has been minimized.

Copy link

@IngoMeyer441 IngoMeyer441 commented Jul 8, 2021

Why is the first wincmd with $ and the second without?

  • $wincmd w focuses the last window because $ always references the highest window number.
  • wincmd J moves the focused window to the bottom, so in this case the window for the merged file view.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment