In most distributions VI is the default text editor. Although it has good features, it is not at all user-friendly for the lay user.
Execution modes
In VI there are three execution modes:
- Navigation mode
- Insertion mode
- Command mode
Navigation mode
It’s the VI’s initial mode. When we start editing a file, we are dropped into navigation mode. It is from navigation mode that we can then enter Insertion Mode and Command Mode
# vi /etc/apache2/apache.conf
After the above command we are in navigation mode. This mode allows you to execute a series of commands, see the command table below:
[table id=”1″ /]
Insertion mode
To enter insert mode, press the “i” or “a” key. When you enter insert mode, you can insert and delete text in the file.
To end insertion mode and return to navigation mode, press the “ESC” key.
Command mode
To enter control mode, press the ” : ” key.
This command is preceded by another command, thus executing an action according to the table below:
[table id=”2″ /]
Remember that some commands have the same action.