The screen-based text editor application Vim is open-source and free. It is a more advanced version of Bill Joy’s vi Bill Joy is the creator of Vim, developed the program from a port of the Stevie editor for the Amiga, and made it available to the public in 1991. By default Vi, comes packaged in every Ubuntu Machine but for Vim you need to install it using the command below. Like other types of programming, vim script files are kept in plain text and often end in.vim , this doesn’t apply to the .vimrc configuration file for Vim. It should be noted that every command that we run for Vim editor will also work for Vi editor because vim as we mentioned earlier is an improved version of Vi. Another similar guide can be referenced from this link: How to Save Read-Only Files in VIM Editor in Linux/Unix-like OS.
Kindly refer to these interesting guides: Remove Office license file: How do you change the account that Office says it belongs to on a Mac, Uninstall Office: How to remove Microsoft Outlook, Teams, Words PowerPoint, and Excel apps from Mac, and Cannot uninstall the OneDrive App: The item “OneDrive” can’t be moved to the Bin because it’s open on Mac.
Below is the prerequisite that needs to be met in order to exit the editor.
- Ubuntu Machine
- A user account with Sudo privileges
Vim does not come pre-installed, so we need to install it with the command
apt install vim
Below are the various modes available within the Editor.
- Normal mode: Vim launches in “normal” mode by default. By hitting
Esckey while in another mode, you can return to normal mode. The expected behavior of key presses is not present in Normal mode. In other words, they don’t add text to the page; rather, certain key hits should
- Insert Mode: Most individuals will be most familiar with this conduct because it is the second most prevalent mode. I for ’insert’, this immediately switches vim to insert mode by using an insert command from regular mode, you may input it. Several insert instructions are
A for "append,” which advances the cursor after the current character and enters insert mode, and
o for "insert,” which inserts a new line below the current line and enters insert mode on the new line.
Exit Vim in Terminal
Let’s create a document in Vim and escape. In the demo, we will create a document called exitvimtutorial. We can do this with the command below: You can choose to call it any name that you want but the most important thing is for the keyword vim to be in front of the name in this format
To work on the newly created file, we need to hit
I for insert mode. And we can type anything to create a file with content in it. As we can see from the screenshot below, we had the steps typed
Change to command mode in Vi/Vim to give commands.
- Press the
- Observe the —INSERT— label disappear from the lower-left corner of the screen.
Enterto save your changes before exiting. Any modifications made will be saved as a result. In response, Vim will print the filename, whether it is fresh, and the number of characters that were written to the hard disk.
:qto leave Vi/Vim.
If you must use Linux via the editor, you will have to familiarize yourself with the following useful commands.
Esc– changes to command mode
:w–list the modifications performed
:q– exit Vim
:q!– exit Vim and discard any changes
:wq– saves the modifications and quits Vim
x– save the modifications, then quit Vim
Vim is a modification of Vi and any command for vim will work for vi. Vi comes installed by default but for vim, you will need to install using the package manager. We exited vim by following a series of steps as shown above.