Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
$ git config --get core.editor

(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?

share|improve this question
did you try setting full path to vim in git config or $EDITOR? – skarface Aug 30 '13 at 17:48
@skarface Ah: I did in Git, but forgot to go back and do it in EDITOR. Let me try... – Kazark Aug 30 '13 at 18:57
@skarface It looks like core.editor has higher priority than EDITOR, so I'm going to stick to modding that. I guess I haven't figured out what the correct full path is for Cygwin Vim though from the perspective of Windows Git running within Cygwin... or do I want to use Windows Vim? – Kazark Aug 30 '13 at 19:00
up vote 6 down vote accepted

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 or vimdiff.

I had to do:

git config --global core.editor C:/cygwin/bin/vim.exe

I am not sure why the above worked, since:

$ which vim


$ ls C:/cygwin/usr/bin
ls: cannot access C:/cygwin/usr/bin: No such file or directory

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:

$ git config --global diff.tool vimdiff
$ git config --global difftool.vimdiff.cmd  'C:/cygwin/bin/vim.exe -d "$LOCAL" "$REMOTE"'

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:

diff 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:

set shell=bash

and now everything works smoothly.

share|improve this answer
On Cygwin, /bin and /usr/bin are one and the same, but Windows doesn't know that and only sees the "real" C:\cygwin\bin. That being said, for better integration, you're better off using Cygwin's git package. – Yaakov Sep 16 '13 at 5:16
@Yaakov: yeah, probably would be better off with Cygwin Git. The nice thing about using the Windows Git though is that I can do Git-TFS commands with it. When I originally posted the question I didn't realize I was using Windows Git. – Kazark Sep 16 '13 at 13:07
perfect. that worked for me. +1 – amphibient Nov 19 '14 at 18:36

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.