To save a file and exit Vim, do the following:
- 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 exit Vim without escape key?
Use Alt/Meta In a Terminal
Meta keys were used on some old systems. If you use Vim in a terminal, simply press alt/meta+normal_mode_key. Most terminals send an escape character followed by the normal_mode_key that you pressed, removing the need to press escape yourself.