Hit the Esc key; that goes into command mode. Then you can type
:qto quit (short for
:q!to quit without saving (short for
:wqto write and quit (think write and quit)
:xto write and quit (shorter than
:qato quit all (short for
When you press
: will appear at the bottom of the screen.
Or you can press Esc
ZZ (Esc Shift+Z Shift+Z) to write/save if the file was changed, then quit.
Or if you don’t want to save changes you can use ZQ instead.
Vim has extensive help, so type Esc
:helpReturn and you will have all your answers and even a neat tutorial.