Home Writing

til / quit and save in vim

While using the terminal, git or other commands might open Vim. Despite the running joke around the internet that it’s impossible to quit Vim, it’s not hard and also useful to know how to get out.

First, make sure that you’re in normal mode. If you haven’t changed any settings, you’ll get to normal mode by pressing Esc. From here, you can use any of the following commands:

  • :q - quit (short for :quit)
  • :q! - quit without saving
  • :qa - quit and close all buffers
  • :wq - write (save) and quit
  • :wq! - write and quit even if the file is in read only mode
  • :x - write and quit (only writes if there are changes)
  • ZZ - same as :x

  • Loading next post...
  • Loading previous post...