How can I set up an editor to work with Git on Windows?

后端 未结 30 1235
悲哀的现实
悲哀的现实 2020-11-22 13:57

I\'m trying out Git on Windows. I got to the point of trying \"git commit\" and I got this error:

Terminal is dumb but no VISUAL nor

30条回答
  •  野性不改
    2020-11-22 14:21

    I also use Cygwin on Windows, but with gVim (as opposed to the terminal-based Vim).

    To make this work, I have done the following:

    1. Created a one-line batch file (named git_editor.bat) which contains the following: "C:/Program Files/Vim/vim72/gvim.exe" --nofork "%*"
    2. Placed git_editor.bat on in my PATH.
    3. Set GIT_EDITOR=git_editor.bat

    With this done, git commit, etc. will correctly invoke the gVim executable.

    NOTE 1: The --nofork option to gVim ensures that it blocks until the commit message has been written.

    NOTE 2: The quotes around the path to gVim is required if you have spaces in the path.

    NOTE 3: The quotes around "%*" are needed just in case Git passes a file path with spaces.

提交回复
热议问题