To save a file with or without exiting Vim, enter the Command Mode by pressing Esc. Then, press Shift + ; (to type :, the colon sign). In front of the colon, type x, press Enter to save your file, and quit Vim. You can also type w and press Enter to save your file without exiting Vim or q! to close Vim without saving your file.