To exit the Vim text editor, you can use one of the following commands:
- Save and exit:
:wq
- Exit without saving:
:q!
- Save changes, but exit only if there were no changes:
:q
Note that :q
will only exit the editor if there have been no changes made to the file. If you have made changes and want to exit without saving, use :q!
instead.