Question: vim how to save and quit?
Answer: Switch to command mode by pressing the ESC key.
Press : (colon) to open the prompt bar in the bottom left corner of the window.
Type x after the colon and hit Enter. This will save the changes and exit.