Why does `:Wq` in VIM cause my commit to fail later?

JKillian

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>?

Jonathan.Brink

This article seems to describe a similar issue.

Looks like when you use the capital 'W' Vim is exiting with an error code when invoked by Git.

Have you tried:

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

(or wherever you have vim installed on your system)...which seemed to clear up the issue. Must be related to how how Git invokes Vim.

Also, see this question which indicates that it may have to do with the filetype setting.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Java

Why does assembly binding fail in my project?

From Dev

Why does this mapcan cause my REPL to freeze?

From Dev

Why does dequeueReusableCellWithIdentifier cause my whole app to crash/hang?

From Dev

Why does my cross-compiling fail?

From Dev

Why does my extension method cause a type error?

From Dev

Why does my redirected CORS request fail?

From Dev

Why does a second parameter cause this script to fail?

From Dev

Why does my code perform the later cout first?

From Dev

Why does my while code cause my simulator to crash?

From Dev

Why does rotation cause Android fragment replacement to fail?

From Dev

Why does :w! work but not :wq? File is read only error

From Dev

Why does my rspec test fail?

From Dev

Why does git commit (vim?) color the messages this way?

From Dev

:wq in Vim does not save

From Dev

Why does this code fail to compile, citing type inference as the cause?

From Dev

:wq in Vim does not save

From Dev

Why does my kernel fail to build?

From Dev

Why does my NSMutableURLRequest fail?

From Dev

Why does my linq to sql query fail?

From Dev

Why does my pointer arithmetic fail in this array

From Dev

Why does my vim colorscheme stay after I close vim?

From Dev

Why does my wifi fail to stay connected?

From Dev

Why does rsync cause my system to fail booting?

From Dev

Why does this jQuery cause *all* my jQuery to fail?

From Dev

Why does my jasmine tests fail on this directive?

From Dev

Why does my vim-7.3 compile fail to include clientserver?

From Dev

Why does calling anotherForm.ShowDialog() cause exceptions in System.IProgress.Report() later?

From Dev

Why does my Vapor query always fail?

From Dev

Why Does My FAMILY Query Fail?

Related Related

HotTag

Archive