First, the editing mode
Keys |
Role |
I |
Insert in current word match either |
I |
Insert at the beginning of the line where the cursor is located |
A |
Insert in current word specifier |
A |
Inserts at the end of the line where the cursor is located |
O |
Inserts a new row on the next line in the current row |
O |
Inserts a new line on the current line |
Second, the command mode
Command |
Role |
/word |
Look for a character after the cursor word, press N to continue searching backwards |
? word |
Look for a character before the cursor Word, press N to continue searching |
: n1,n2s/word1/word2/g |
Find word1 between n1-n2 rows and replace with Word2, and no G replaces only the first word1 of each row |
: 1, $s/word1/word2/g |
Replace all word1 in the document with Word2, and no G replaces only the first word1 of each row |
: W |
Save text |
: Q |
Exit vim |
: w! |
Force save, under root user, even if the text is read-only |
: q! |
Force exit, all changes are not valid |
: Wq |
Save exit, Mtime will update even without any changes |
: X |
Save exit, Mtime does not update if no changes are in the |
: Set Nu |
Show line Numbers |
: Set Nonu
|
Do not display line numbers |
: Nohl |
Cancel highlighting |
Vim tools are used in a variety of ways, do not need to be deliberately to remember each, just remember some common. Other usually can practice familiar under.
This article is from the "garbled Age" blog, please be sure to keep this source http://juispan.blog.51cto.com/943137/1940737
[CentOS 7 Series] Vim edit mode and command mode