Vim character substitution and revocation (undo action)

Source: Internet
Author: User

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
CUppercase Replace cursor later to end of line
~ Reverses the case of a cursor in the same letter
uN Undo One or N operations
UUppercase 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)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.