2

Versions of things:

  • OS: Win 8.1
  • Vim: 8.1
  • Git: 2.18.0.windows.1
  • GNU bash: 4.4.19(2)

I am trying to use vimdiff in Git Bash but I get E97:Cannot create diffs error. From there both files are open next to each other but there is no syntax help for the differences. Once I quit both files and go back to the bash terminal I see this:

/usr/bin/bash: /usr/share/vim/vim81diff: No such file or directory

It looks to me like Git Bash is looking in the wrong place for the diff program. But it still passes the files into vim so I am not sure. Git Bash has brought its own copy of vim where all the support files are in

/usr/share/vim/vim81/

but the exes (vimdiff.exe, vim.exe, etc) are in

/usr/bin/

if I run

$ which -a vimdiff

it returns

/usr/bin/vimdiff
/bin/vimdiff
/usr/bin/vimdiff

This is from a fresh install of Git.

I have used the full path to the vimdiff in the Git Bash folder. I have also created two test files and run vimdiff on them inside of the /usr/bin/ directory and got the same results.

If I use my local install of vim by going to cmd and go to the same directory and use them on the same files it works as expected. This is just happening in Git Bash. I would like to have vimdiff set as my git difftool but need to get vimdiff working.

Any idea about what is causing this and how to resolve it?

atoms
  • 85
  • 1
  • 8
  • 1
    What the diff.tool is set to? (https://stackoverflow.com/a/17541084/6309) – VonC Aug 24 '18 at 04:44
  • @VonC At the moment vimdiff. When using whatever the default is it does work, but I don't know what the default diff.tool is for Git Bash. When I am using vimdiff as the diff.tool I am getting the same result detailed above. To be clear, right now I am just trying to get the "vimdiff file1.txt file2.txt" to work in Git Bash as it should. Git is not playing a role in these tests yet. Once that works I will move onto getting it setup as the diff and merge tools for git. Thanks – atoms Aug 24 '18 at 13:55

1 Answers1

5

Indeed the system is looking for the diff program in a place where it isn't. I had the same problem, and solved it by creating a link to the diff tool in the place where vim expects it to be.

  • in git bash, go to /usr/share/vim
  • create the link: ln -s /usr/bin/diff vim81diff

In my ~/_vimrc file, there is a MyDiff() function with expects the diff executable to be composed by $VIMEXECUTUABLE suffixed by diff, resulting in vim81diff, which is not there in my git bash installation.

I don't know whether it matters for the problem, but I have a separate vim 8.1 installation on Windows 10, which uses the same _vimrc.

MinCoz
  • 51
  • 1
  • 2