To save an existing file in Vim, follow these steps:
- Press
Escto ensure you are in normal mode. - Type
:wand pressEnter.
This command writes (saves) the changes made to the file without exiting Vim. If you want to save and exit at the same time, you can use :wq.
If you need to save the file under a different name, you can use :w new_filename.txt.
