How to quit vim safely?
:wq
Save and quit. If you create a new file and write none , use the command, the new file will not disappear and will be save with no word.
ZZ
Save and quit. Note that is upper case. If you create a new file, and write even one character (and than you delete the character you have writen), ZZ will save the file. But if you has not writen any time, the file will disappear, even you had enter insert mode.
:q!
Quit and don't save.