Why does `: Wq` in VIM make my commit work later?

Often, when I finish writing a commit message in VIM, I type :Wq<ENTER>instead :Wq<ENTER>because I hold down the shift key to type a colon. This makes VIM respond E492: Not an editor command: Wq.

So far so good, I'm just retyping :Wq<ENTER>to save the commit message and exit VIM. However, the commit does not work, 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 would accidentally input :Wq<ENTER>before doing the correct :Wq<ENTER>result in commit failure? Is there a way to get a commit after input :Wq<ENTER>?

+4
source share
2 answers

, , .

, "W" Vim Git.

:

git config --global core.editor /usr/bin/vim

( , vim )... , , . , Git Vim.

. , , filetype.

+4

. , E492: Not an editor command: Wq, :wq vim .

, - - fooobar.com/questions/53572/...

:command WQ wq
:command Wq wq
:command W w
:command Q q

"" ~/.vimrc, :wq, .

, , Jonathan.Brink, , vim, vi, .

+2

Source: https://habr.com/ru/post/1621640/


All Articles