Vim replacement command

Source: Internet
Author: User

Vim replacement character:
Syntax: [ADDR] S/source string/destination string/[Option]
Global replacement command: % S/source string/destination string/g
[ADDR] indicates the search range. If it is omitted, it indicates the current row.
For example, "1st" indicates the number of rows from to 20;
"%": Indicates the entire file, which is the same as "1, $ ";
"., $": From the current row to the end of the file;
S: indicates the replacement operation.
[Option]: indicates the operation type.
For example, G indicates global replacement;
C Indicates confirmation
P indicates that the replacement result is displayed row by row (CTRL + l restore the screen );
If option is omitted, only the first matching string in each line is replaced;
If special characters appear in the source string and target string, escape them "\"

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.