List of content you will read in this article:
Vim is one of the most reliable and powerful open-source text editors available for several operating systems. Commonly, the Vim text editor is also known as Vi. Initially, Bill Joy discovered this editor in the 1970s. At that time, Vi was short form for the visual editor.
Vim is an extremely fast and efficient UNIX text editor. It is also inclusive in Linux and macOS. You can feel free to write or edit text with the help of this tool via a command-line interface or as an application. There are ample features and commands associated with Vim. Here, we are going to learn about how to save Vim and exit Vim methods.
Let’s dive in!
By default, For starters, when you launch vim the file opens in the command mode; tells you that you are not able to enter any new text, instead, you can edit or move the file.
If you wish to enter the text, switch on the insert mode. For that, you have to Press I and it will allow you to type any text in the file.
Save VIM/Exit VIM Editor [A Definitive Guide]
Method 1: How to save in vim and quit in Vim [Exit vim], follow the below-listed steps:
Step 1: Initially move to the command mode. To do that, press the ESC key
Step 2: Now, press colon. In the bottom left corner, it directs you to the prompt bar
Step 3: Type x and press enter. It will save vim and exit vim
Additionally, you can also accomplish this task by using a command. Take a look:
w = write (save)
q = quit
Now, there is another method to save in Vim editor, without exiting. Let us see how!
Method 2: If you want to save a file in vim and do not wish to exit in Vim, follow these steps:
Step 1: Press the ESC key to switch into the command mode
Step 2: Now, type colon. It takes you to the prompt bar as shown in the below-listed screenshots:
Step 3: Type w and now press Enter. This helps you to make changes in the file without exiting from the text editor
Besides, you can also rename files and to do so you have to follow the below-listed Linux command.
Here is a screenshot for you.
How to Exit VIM without saving a file? [Quit VIM]
To execute this process we have to follow the below-given steps:
Step 1: You have to press the ESC key and you will move to the command mode.
Step 2: After that, you have to press colon to open the prompt bar
Step 3: Now, type q, and press enter to exit the text editor without saving any changes.
Take a look at the screenshot in which we have been listed below.
As we hope that you are now familiar with How to save vim and quit vim/exit vim editor? That have been listed above in the two methods. VIM editor has a lot of shortcuts to accomplish your work in very less time and it will increase your productivity level too. Every time an expert who is looking for shortcuts or to save a file or exit file should implement the above listed commands.
Also, if you think there can be any other methods to save a file or exit a file in vim editor, do let us know via comment box listed below.
Keep Learning & Exploring Vim Editor.
People Are Also Reading: