Watch video tutorial: Brother even Linux cloud computing Video tutorial 5.1 text editor Vim-5.2
Insert command
A: Insert the word specifier in the cursor position;
A: Insert at the end of the line where the cursor is located;
I: Insert the word match either in the cursor position;
I: Inserted at the beginning of the word lines the cursor;
o: Insert a new line under the cursor;
O: Insert a new line on the cursor;
: Set nu sets the line number;
: Set Nonu cancel line number;
to the specified line
GG: to the first line;
G: to the last line;
NG: to Nth row;
: N to Nth Row;
$: Move to the end of the line;
0: Move to the beginning of the line;
Delete command
X: Delete the character at which the cursor is located;
NX: Delete the n characters after the cursor is located;
DD: Delete the line where the cursor is located;
NDD: delete n rows;
DG: Delete the line at the cursor to the end of the file;
D: Delete the cursor at the end of the line;
: n1,n2d deletes the specified range of rows;
Copy paste Cut
YY: Copy the current line;
Nyy: Copies the following n rows of the current row;
DD: cuts the current line;
NDD: Cuts the current row following n rows;
P,p: Pasted on the line or line of the current cursor;
R: replaces the character at which the cursor is located;
R: The replacement character starts at the cursor location;
U: Cancel the previous operation;
Search and Replace commands
/string: Searching for a specified string; Ignoring case when searching: Set IC
N: Searches for the next occurrence of the specified string;
:%s/old/new/g: Full text replaces the specified string;
: n1,n2s/old/new/g: Replaces the specified string within a certain range, and the subsequent G change to C makes a replacement query confirmation.
Save and Exit commands
: W Save
: W new_fliename Save as specified file
: Wq Save changes and launch
ZZ shortcut key Save changes and exit
: q! Do not save changes launched
: wq! Save Modification Exit (file owner and Root available)
Vim Editor General operations