ZZ Save (write) and quit file.:x Save (write) and quit file.
:wq Save (write) and quit file.
:w Save (write) file.
:w filename Write current buffer to filename.
:q Quit file.
:q! Quit file with no save.
Q Quit vi and invoke ex.
:e file Edit file without leaving vi.