Inner: Need to understand the importance of VI. It is the only text editor that the RISC System / 6000 is unique under maintenance mode. It is all UNIX and UNIX-based standard text editors. Its command line editing feature. It is the default editor of some programs. Since the function is very powerful, only part of the most commonly used VI is described below.
VI use details
(1) Entering and exiting VI
Enter: SHELL mode, enter vi filename or direct vi.
Exit: COMMAND mode.
Exit does not save the file (the user does not change the file): Q
Forced to withdraw from save files: Q!
Exit and save files: WQ or: x or
Exit and save (for read-only files): WQ!
(2) Command mode and editing mode switch
Enter vi filename directly into Command Mode directly in Shell mode
Under Command Mode, press "Insert" or "i" or "i" or "a" or "a" to enter Edit Mode
EDIT MODE ESC button Enter Command Mode
(3) Editing instructions (works under Command Mode)
Cursor Move: The upper and lower left and right respectively k J H L key (sometimes the direction of the standard keyboard is not supported)
W or W cursor moved to the beginning of the next word
B or B cursor moves to the beginning of the previous word
e or e curst moved to the next word
H cursor moved to the screen
M curst moved to the middle of the screen
L Move to the screen
1G cursor moved to the beginning of the file
20G cursor moved to the beginning of the 20th line
G cursor moved to the beginning of the file
Text Editor: a after the cursor
A in the tail
i add word at the cursor
I adds in the lead
x Delete the character at the cursor
DW Deletes all characters from the cursor position to the word
D $ deletes all characters from the cursor location to the end
D0 Deletes the cursor position to all characters of the lead
DD cutting
10dd cut from the current 10 lines
YY copy current line
p stick
: 10, 50D Delete the 10th to 50th line
u revocation operation (only to revoke once)
/ Character or string
? Character or string
: g / character or string 1 / s // character or string 2 / g Replace characters or string 1 in full text characters or string 2 1
o Insert a line
:! Command executes the system instruction and returns VI (such as:! ls)