I am using git within Cygwin 64 under windows. The default editor vi and git uses the default editor. When I call 'git commit' following messages will be prompted before vim is started:
git commit Vim warning: output is not to a terminal Vim warning: input is not from a terminal
After that, vi will started but can't be controlled, 'ESC', ':' can't be used and I have to kill the cygwin window.
How can I use vim for the 'git commit'?
Git command works in the command line interface. The vim plugin named fugitive plugin is developed by Tim pope which is used to work with the git tool without terminating the editor. So, vim and git can work together by using the fugitive plugin.
This might be cause by mintty, see this issue.
There are two ways to fix:
Use bash.exe instead of mintty:
Right click on the shortcut of cygwin, change it from C:\cygwin64\bin\mintty.exe -i /Cygwin-Terminal.ico -
to C:\cygwin64\bin\bash.exe --login -i
Add the correct vim path to git config:
git config --global core.editor "C:/cygwin64/bin/vim.exe"
Note that don't use cygdrive
in the path as .gitconfig
can't recognize it. And if you are using 32-bit vim, then the path should be C:/cygwin/bin/
You may have Git for Windows (msysgit) or Vim for Windows installed. Out of the box they are not compatible with Cygwin64 - you would need to configure your pathing for Cygwin to ignore those installations.
The easier option would be to uninstall both of those items and just use the Cygwin version.
If you need to keep them for whatever reason, set your $PATH
variable in your .bash_profile
as an override. Use your existing $PATH, minus the msysgit and windows vim paths. If you're into bash scripting, you could try the following to remove the paths when using bash, modified to your particular situation:
msysgit='/cygdrive/c/Program Files/git:' PATH="${msysgit//$PATH/}" msysvim='/cygdrive/c/Program Files (x86)/vim/vim74:' PATH="${mysysvim//$PATH/}"
Good luck!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With