Substitution and revocation of characters (undo action) 1. Replace and revoke (undo) command
Both the Replace and undo commands are for normal mode operations
Command |
Description |
r + <待替换字母> |
Replace the letter that contains the cursor with the specified letter |
R |
Continuous replacement until you press theEsc |
cc |
Replace the entire row, which deletes the row of the cursor and enters insert mode |
cw |
Replace a word, delete a word, and enter insert mode |
C Uppercase |
Replace cursor later to end of line |
~ |
Reverses the case of a cursor in the same letter |
u N |
Undo One or N operations |
U Uppercase |
Undo all changes to the current line |
Ctrl+r |
Redo, that is, undo undo operation |
To open a file for editing:
$ vim practice_2# 输入以下文本www.shiyanlou.com
Then do the following:
- Enter FA to jump to the first
a
character
- Input
r
, and the input b,a character is replaced by the B character (practical)
- Enter a
R
replacement character, enter a new string, press ESC to return to normal mode (useful)
- Enter
cc
replace whole line character, enter new string, press ESC to return to normal mode after entering
- Enter
cw
replace one English word (word), press ESC to return to normal mode (useful)
- Input
~
, the case of the character in which the rollover cursor is located
- The input is
C
replaced with the end of the line, that is, the word will be replaced after the cursor is in place, press ESC to return to normal mode
- Enter
u
undo Last action
Finally, you can try to enter the text content of more lines, and jump to the specified line of action:
- Input
2G
, jump to 2 lines
Vim character substitution and revocation (undo action)