Iii. VI usage learning-TIPTOPGPERP secondary development tutorial
Basic concepts of VI
1. Three Modes of VI
VI can be divided into three operation statuses:
Command mode, Insert mode, and last line mode)
Command mode ):
Control the movement of the screen cursor, move the character or cursor, delete, copy a region, and switch to the Insert mode or to the last line mode ).
Insert mode ):
In insert mode, text data can be input. Press esc to switch back to command mode.
Last line mode ):
When the storage file leaves the editor, you can also set the editing environment, such as searching strings and listing row numbers.
Note:
However, you can simplify vi into two modes, that is, the Last line mode is also counted into Command mode, and vi is divided into Command and Insert mode.
VI basic operations
1. Go to VI
2. mode switching: <喎?http: www.bkjia.com kf ware vc " target="_blank" class="keylink"> Required/MHuPC9wPg0KPHByZSBjbGFzcz0 = "brush: java;"> I indicates insertion, and insert the entered text from where the current cursor is located. I indicates moving the cursor to the beginning of the line and inserting the entered text a here to indicate addition, input text o from the next word where the cursor is currently located to Insert a new row under the cursor and input text from the beginning of the line. O (uppercase letters) indicates to insert a new row on the cursor, and input text from the beginning of the line esc indicates to switch from insert mode back to command mode
(2) switch the command mode to the last line mode command
: W file_name indicates saving the text to the specified file_name file: wq indicates storing the edited file and leaving VI: q! Indicates that the file is forcibly removed and edited is not discarded.
3. Exit and save
Operations in command mode 1. move the cursor
Vi can be moved up and down directly with the cursor key on the keyboard,Regular vi uses lowercase letters h, j, k, and l to control the left, top, bottom, and right of the cursor (this method is recommended, because not all unix systems support up and down movement on the keyboard).
2. Control commands
3. Delete characters
4. Search for characters
5. Replace characters
6. Copy and move
7. Cancel the operation
8. Comment