Vim-> while confirming and searching for replacement

Source: Internet
Author: User

When performing simple global search replacement, you can use the following ex command:

: % S/which/what/g


It is easy to use

% Each row (everyline)
S Replace (substitue)
Which Search content
What Replaced content
G Global on that line)

In this way, you can quickly implement the global search and replacement function, but sometimes we do not want to complete all the replacement operations at a time, it is possible that we only want to replace a part.

To implement this operation, we first think of the execution sequence as search-> modify? -> Modify-> Find Next-> modify? -> Modify.

The specific commands can be executed in the following order:

/Which Search
Cwwhat [ESC] Chang word
N Next, no need to replace
N Proceed to the next step and modify it.
. . (DOT) is used to repeat the previous operation, that isCwwhat [ESC]


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.