Array
University of Oregon

How to Exit the Vim Editor

While you are learning  git commands, it’s easy to omit some essential part of a command. This will occasionally cause git to start a command line editor named Vim.

For example, the following command is missing a commit message:
$ git commit

Therefore, Git will start Vim, and prompt you to enter a commit message in the Vim editor window:

How to Exit Vim (:q)

If your screen looks similar to the above, you are in Vim. It’s not easy getting out. To exit the Vim editor and return to the shell, follow these steps:

  1. Hit the  Esc key.
  2. Enter the following: :q (short for :quit)
  3. Hit the Enter key.

If you are still stuck, read more at Stack Overflow.


Switch Off Vim

To prevent git from sending you to vim in the future, use this config command:

git config --global core.editor="nano"

Skip to toolbar