Q:

Errors using Vim for commit

Windows 7 x64
Can't understand my mistake.

$ git config --global core.editor vim
$ git commit

.gitconfig path: editor = vim

E325: ATTENTION
  Error: There was a problem with the editor 'vim'. Please supply the message using either -m or -F option.

$ git config --global core.editor "'vim' -w"
$ git commit

.gitconfig path: editor = 'vim' -w 
When Vim has opend, it's empty, but should contains something like $ git diff 

$ git config --global --unset core.editor
$ git commit

E325 ATTENTION
  Aborting commit due to empty commit message.

I thought Vim uses by default.

$ EDITOR=vim
$ git commit

E325 ATTENTION
  Aborting commit due to empty commit message.

$ vim --version
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Jun  1 2017 21:25:47)

Заплатки: 1-606

Скомпилирован  <alexpux@gmail.com>
Огромная версия без графического интерфейса.
Включённые (+) и отключённые (-) особенности:
+acl             +file_in_path    +mouse_sgr       +tag_old_static
+arabic          +find_in_path    -mouse_sysmouse  -tag_any_white
+autocmd         +float           +mouse_urxvt     -tcl
-balloon_eval    +folding         +mouse_xterm     +termguicolors
-browse          -footer          +multi_byte      +terminfo
++builtin_terms  +fork()          +multi_lang      +termresponse
+byte_offset     +gettext         -mzscheme        +textobjects
+channel         -hangul_input    +netbeans_intg   +timers
+cindent         +iconv           +num64           +title
-clientserver    +insert_expand   +packages        -toolbar
+clipboard       +job             +path_extra      +user_commands
+cmdline_compl   +jumplist        +perl/dyn        +vertsplit
+cmdline_hist    +keymap          +persistent_undo +virtualedit
+cmdline_info    +lambda          +postscript      +visual
+comments        +langmap         +printer         +visualextra
+conceal         +libcall         +profile         +viminfo
+cryptv          +linebreak       +python/dyn      +vreplace
+cscope          +lispindent      +python3/dyn     +wildignore
+cursorbind      +listcmds        +quickfix        +wildmenu
+cursorshape     +localmap        +reltime         +windows
+dialog_con      -lua             +rightleft       +writebackup
+diff            +menu            +ruby/dyn        -X11
+digraphs        +mksession       +scrollbind      -xfontset
-dnd             +modify_fname    +signs           -xim
-ebcdic          +mouse           +smartindent     -xpm
+emacs_tags      -mouseshape      +startuptime     -xsmp
+eval            +mouse_dec       +statusline      -xterm_clipboard
+ex_extra        -mouse_gpm       -sun_workshop    -xterm_save
+extra_search    -mouse_jsbterm   +syntax
+farsi           +mouse_netterm   +tag_binary
            общесистемный файл vimrc: "/etc/vimrc"
         пользовательский файл vimrc: "$HOME/.vimrc"
  второй пользовательский файл vimrc: "~/.vim/vimrc"
          пользовательский файл exrc: "$HOME/.exrc"
           defaults file: "$VIMRUNTIME/defaults.vim"
          значение $VIM по умолчанию: "/etc"
   значение $VIMRUNTIME по умолчанию: "/usr/share/vim/vim80
"
Параметры компиляции: gcc -c -I. -Iproto -DHAVE_CONFIG_H   -D_FORTIFY_SOURCE=2
-I/usr/include/ncursesw  -march=x86-64 -mtune=generic -O2 -pipe
-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Сборка: gcc   -L. -pipe -fstack-protector -pipe -Wl,
--as-needed -o vim.exe     -lm    -lncursesw -liconv -lacl -lintl   -Wl,
--enable-auto-import -Wl,--export-all-symbols -Wl,
--enable-auto-image-base -fstack-protector-strong  
-L/usr/lib/perl5/core_perl/CORE -lperl -lpthread -ldl -lcrypt

A:

I came across this very error today.  I'm posting my solution here in the event it helps someone else.  First, a little back story on how I got myself in the predicament of getting this error (TL;DR? Jump down to the "Solution" section).
I have VIM set up as my default editor and was writing my commit message.  As usual, I forgot to use Shift+Insert to paste a line of text and instead used Ctrl+V.  With my head still in Windows-mode, I tried to "undo" my mistake by hitting Ctrl+Z (it's just too natural).  A flurry of ESC presses and attempts at :q! later, I was out of commission.  VIM would not respond to ANYTHING.  I had to kill the process using Windows Task Manager.  From that point on, I kept getting the OP's error every time Git launched VIM (for a commit message, for a rebase -i, etc.).
I noticed, however, that the problem occurred ONLY in the repository I was in when I messed up VIM.  Git's launching of VIM worked fine in other repos.  Googling around, I was reminded of VIM's swap files.
Solution
Sure enough, I found a rogue swap file in the .git directory of my affected repo and, making sense, it was for the COMMIT_EDITMSG file.  Deleting this swap file (*.swp) fixed the problem.

