VIM for Windows – What do I type to save and exit from a file?

Using WinXP 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).

  • Are there any concurrency issues in backing up git?
  • What options do I have for continuous integration, git project management, and client management
  • Rebase commits on remote branch
  • Git installer for Mac: Why is /usr/local/git/bin in my PATH?
  • 'Git could not checkout' error is causing problem while deploying an app on engineyard
  • phpstorm looking for ssh key in wrong directory
  • How to migrate GIT repository from one server to a new one
  • Is there a tool to watch a remote Git repository on Ubuntu and do popup notifications when commits are made?
  • Import submodule with missing __init__
  • Maintaining directory structure during Android Studio import
  • Git and TFS integration for TFS Build
  • How do I push to a pull request on github?
  • 6 Solutions collect form web for “VIM for Windows – What do I type to save and exit from a file?”

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

    :wq
    

    Instead of telling you how you could execute a certain command (ESC:wq), I can provide you two links that may help you with VIM:

    However, the best way to learn VIM is not only using it for Git commits but as regular editor for your everyday work.

    If you’re not going to switch to VIM, it’s nonsense to keep it’s commands in mind. In that case, go and set up your favourite editor to use with Git.

    Esc to make sure you exit insert mode, then :wq (colon w q) or ZZ (shift-Z shift-Z).

    • Press i or a to get into Insert mode, type message of choice

    • press several times ESC to get out of Insert-Mode, or any other mode you might have ran into by accident

      • to save, :wq, :x or ZZ

      • to exit without saving, :q! or ZQ

    EDIT:
    To reload a file and undo all changes you have made…
    Press several times ESC and then enter :e!.

    A faster way to

    • Save
    • and quit

    would be

    :x
    

    If you have opened multiple files you may need to do a

    :xa
    

    :q! will force an unconditional no-save exit

    Git Baby is a git and github fan, let's start git clone.