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

后端 未结 30 972
悲哀的现实
悲哀的现实 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 13:57

    Edit: After updating to Vim 7.3, I've come to the conclusion that the cleanest and easiest way to do this is:

    1. Add Vim's main folder to your path (right click on My ComputerPropertiesAdvancedEnvironment Variables)

    2. Run this:

      git config --global core.editor "gvim --nofork '%*'"
      

    If you do it this way, then I am fairly sure it will work with Cygwin as well.

    Original answer:

    Even with a couple of Vim-related answers, I was having trouble getting this to work with gVim under Windows (while not using a batch file or %EDITOR% or Cygwin).

    What I eventually arrived at is nice and clean, and draws from a few of the solutions here:

    git config --global core.editor \
    "'C:/Program Files/Vim/vim72/gvim.exe' --nofork '%*'"
    

    One gotcha that took me a while is these are not the Windows-style backslashes. They are normal forward slashes.

提交回复
热议问题