How to exit the VIM editor

1 Star2 Stars3 Stars4 Stars5 Stars (4 votes, average: 4.50 out of 5)

VIM is a free text editor, the possibilities of which largely exceed those of “ordinary editor”. However, there is one drawback, namely that the editor interface is not intuitive, so to work with it you need to spend some time to study the commands, hot keys, etc. When you first face VIM, you can easily get lost and not know how to do even simple things, for example how to exit it.

VIM editor exit commands

If you’re using text input mode, you must first press <ESC> to return to normal mode.





This command can help you if the file is opened in “read-only” mode (with -R option), if the file is locked by another user, if there are no such privileges, or there is another problem. If you try to save the file without “!”, a warning will be given.

Create a new file “new_file” and save the current contents. If the file already exists, a warning will be displayed. Then continue to work with the old file – newfile.txt

If there is a message that the disk has no free space when you try to save the file, you can go to the command shell and free up disk space by erasing unwanted files. To do this, use the command

Press CTRL-D or enter “exit” to return from the command shell to the editor

If the file has been modified, you won’t be able to do anything. In these cases, it is necessary to add “!” after the command:

To cancel all modifications of the current session and return to the original version of the file, use the command

Leave a Reply

Your email address will not be published. Required fields are marked *