VIM Survival Commands that you need to Operate it in Ubuntu 20.04:
The survival commands that you need to operate the VIM text editor in Ubuntu 20.04 are discussed below:
Command # 1:
VIM text editor has multiple different modes of operation. However, the most common out of these modes is the Normal mode and the Insert mode. If you ever feel the need for toggling between these two modes, then all you have to do is to press the Esc key. By default, the VIM text editor is in the Normal mode. Pressing the Esc key for once will take you to the Insert mode where you can edit files, whereas pressing the Esc key again will take you back to the Normal mode.
Command # 2:
If you are a naïve user of VIM text editor, then you may make mistakes while editing your files and then get worried about how to revert the changes that you have accidentally made. However, VIM provides you with a very powerful command for undoing what you have unintentionally changed. All you have to do is to switch to the Normal mode and then press u key. Doing this will undo the recently made changes.
Command # 3:
Now when you have edited your file completely and want to quit from VIM text editor after saving this file, then you will need to switch to the Command mode or Cmdline mode. For doing that, first, you need to be in the Normal mode. Then type a colon to get into the Cmdline mode. Now type wq followed by the colon and press the Enter key to save your newly created file and for exiting from the VIM text editor. This command is also shown in the following image:
Command # 4:
If you have created a very long text file or you are reading a long text file, then you might need to toggle up and down every now and then. For going half page up, all you have to do is to press Ctrl+ u. Typing this key combination will immediately take you to half page up.
Command # 5:
Similarly, for going half page down, all you have to do is to press Ctrl+ d. Typing this key combination will instantly take you to half page down.
Command # 6:
The last survival command that we will talk about is the search command, with the help of which you can easily find something that is written in your file. All you have to do is to press the Forward Slash “/” key. Tap on this key, then type whatever you want and then press the Enter key to find the desired results. If there is more than one result, then you might feel the need to check them all. Press the n key for going to the next search result, whereas if you want to go back to the previous search result, you can press the N key. For demonstrating this command, I had a dummy text file in which I wanted to search for the alphabet “k”. Therefore, I typed “/” followed by the alphabet “k”. The search results of this query are shown in the image below:
In this article, we talked about a few very basic commands that are also referred to as VIM survival commands because whatever you want to do with the VIM text editor, you must know these basic commands for operating it properly. This is not an exhaustive guide; therefore, we did not intend to bombard the reader with tons of different commands. The commands discussed in this article are particularly meant for the people who are new to this text editor.