To exit Vim without saving changes: 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 q! after the colon and hit Enter to exit without saving the changes.