Often when I'm finished writing a commit message in VIM, I type :Wq<ENTER>
instead of :wq<ENTER>
because I'm holding down the shift key to type the colon. This causes VIM to respond with E492: Not an editor command: Wq
.
This is all fine so far, I just retype :wq<ENTER>
to save the commit message and exit VIM. However, the commit does not work then, and the terminal shows something like this:
$ git commit
$ error: There was a problem with the editor 'vi'.
$ Please supply the message using either -m or -F option.
Why does accidentally entering :Wq<ENTER>
before doing the correct :wq<ENTER>
cause the commit to fail? Is there any way to get the commit to happen after entering :Wq<ENTER>
?