How to exit Vim? (6 useful commands)

January 25, 2019

This is a highly common question for first time users of Vim. The answer is that there are many ways to quit vim.

Press esc, type any of these commands, then press enter:

# Write & Quit
:wq

# Force write & Quit
:wq!

# Quit without saving
:q!

# Quit
:q

# Only write if there are changes
# And quit
:x

# Same as x above
:exit