VI has three basic working modes: command line mode, text input mode, and line end mode.

Source: Internet
Author: User

VI has three basic working modes: command line mode, text input mode, and line end mode. Shows their relationships:





Input A, I, and O in command mode to enter the text input mode)

Press ESC in the input mode to enter the command mode)



Input in command mode: enters the last line mode)

If a command error occurs in last line mode, the command mode is returned)


 

Command Line Mode

At any time, no matter what mode the user is in
Press the ESC key to enable VI to enter the command line mode;

In the shell environment (Prompt: $), enter the startup VI command to enter the editor, which is also in this mode.

In
In this mode, you can enter various valid VI commands to manage your own documents. At this time, any character entered on the keyboard is interpreted as an editing command. If the entered character is a valid VI command
VI completes the corresponding action after receiving the USER command. Note that the entered command is not displayed on the screen. If the entered character is not a valid command of VI, VI will ring an alarm.

Text input mode

In command mode, enter the INSERT command I and add command.
, Open command o, modify command C, replace command R or replace command s can all enter the text input mode. In this mode, any character entered by the user is saved as the file content and displayed in
On the screen. During text input, if you want to return to command mode, press the key.

Last Row Mode

The last row mode is also called the ex escape mode.

 

Linux
The VI command and the ex editor have the same functions. The main difference between them is the user interface. In VI, a command is usually a single key, such as I, A, O, etc. In ex, the command is the text ended by pressing the Enter key.
Line. The Linux VI command has a special "escape" command to access many line-oriented ex commands. In command mode, you can press the ":" key to enter the last line mode.
Hour L
Inux
The VI command will display a ":" As the prompt in the last line (usually the last line on the screen) of the display window, waiting for the user to enter the command. Most file management commands are executed in this mode.
(Such as writing the content of the editing buffer to a file in medium size ). After the last line of command execution is complete, the Linux VI command automatically returns to the command mode.
For example:

: 1, $ S/A/G

Replace uppercase A with lowercase A from the first line to the end of the file.

 

If you have changed your mind when entering the command in the last line mode, press the button or use the backspace key to delete all input commands, and then press the backspace key to enable Linux
The VI command returns to the command mode.

 

To switch from command mode to edit mode, TYPE command a or I. To return from text mode, Press ESC. Enter ":" In command mode to switch to the last line mode,
Then enter the command.

 

More:

 

 

Three operating modes and conversion process of Linux vi

Linux VI command details: on-screen text editor VI (2)
Detailed description of inux VI commands: on-screen text editor VI (3)
Linux VI command details: on-screen text editor VI (1)

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.