How to Save Changes in Vim
- 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.
How do I save a file in Vim?
If you didn't make any changes, type :q and press Enter / return. If you made some changes and would like to keep them, type :wq and press Enter / return.