I have Git working with Vim in a Powershell environment on my work laptop (Windows 7). It pops up Vim when I commit or use my git vimdiff
alias.
I have attempted the same setup under Cygwin (being a Unix guy at heart) but when I type git commit
or git vimdiff
, Vim does not pop up; seemingly, though, Git is waiting on Vim because the action never completes until I Ctrl–C (after which it takes a minute or so to recover). I can commit with inline commit messages (git commit -m "I would rather type this in Vim"
) and I can launch Vim/Vimdiff from the terminal with vim
and vimdiff
. I have my editor set to Vim in multiple places:
$ echo $EDITOR
vim
$ git config --get core.editor
vim
(Initially, I had not explicitly set it in Git, but only in the environment variable, and still had the same problem.)
It appears that I am running Windows Git in Cygwin. Being new to Cygwin, I did not realize this when I first asked the question. I could see how that might cause problems, but after playing around I have not yet been able to fix it.
Has anyone seen this problem before? Any idea how to fix it?
Best Answer
Thanks to @skarface, I have solved this problem with respect to commiting. First, as I mentioned in the edit to the question, it turned out I was not running Cygwin Git in Cygwin but actual Windows Git. Thus the integration issue makes sense: it is not finding
vim
orvimdiff
.I had to do:
I am not sure why the above worked, since:
but:
So not sure exactly why that is the path that worked, but it did.
I have now solved it with respect to diffing as well. I had to:
This allowed me to start Vimdiff with Git, but there were still some hickups. I could view the files, but the tool itself was failing to diff, giving these errors:
It looks like what was happening here is that Git was somehow screwing with Vim's
shell
option. In my.vimrc
, I put this command:and now everything works smoothly.