Question: vim how to save and exit?
Answer: The command to save a file in Vim and quit the editor is :wq . To save the file and exit the editor simultaneously, press Esc to switch to normal mode, type :wq and hit Enter .