Vim for Windows - What do I type to save and exit from a file?

orokusaki picture orokusaki · Jan 16, 2011 · Viewed 157.6k times · Source

Using Windows XP I accidentally typed git commit -a instead of git commit -am "My commit message", and now I'm viewing my CMD prompt filled with the file version of my commit message ("Please enter the commit message for your..."). I've added my message to the top, but now I can't figure out how to save and leave. I tried to press Ctrl + W + Q, but it doesn't do anything, but add ^ where the cursor is.

I also tried Esc first, and then Ctrl + W + Q, but it says No write since last change (add ! to override).

Answer

nunopolonia picture nunopolonia · Jan 16, 2011

Press ESC to make sure you are out of the edit mode and then type:

:wq