Vimdiff with git mergetool error: "More than two buffers in diff mode"
- by Elizabeth Buckwalter
I've read Vimdiff and Viewing differences with Vimdiff plus doing various google searches using things like "vimdiff multiple", "vimdiff git", "vimdiff commands" etc.
When using do or diffg I get the error "More than two buffers in diff mode, don't know which one to use".
When using diffg v:fname_in I get "No matching buffer for v:fname_in".
From the vimdiff documentation:
:[range]diffg[et] [bufspec]
Modify the current buffer to undo difference with another
buffer. If [bufspec] is given, that buffer is used. If
[bufspec] refers to the current buffer then nothing happens.
Otherwise this only works if there is one other buffer in diff
mode.
and more:
When 'diffexpr' is not empty, Vim evaluates to obtain a diff file in the
format mentioned. These variables are set to the file names used:
v:fname_in original file
v:fname_new new version of the same file
v:fname_out resulting diff file
So, I need to get the name of bufspec, but the default variables (fname_in, fname_new, and fname_out) aren't set.
I ran the command git mergetool on a linux box through a terminal.