Vim Find/Replace string

Source: Internet
Author: User

The 1.:s command to replace the string.

Replace the current row the first Vivian for Sky:s/vivian/sky/G replaces the current line with all Vivian as Sky:n, $s replace the nth row to start with the first VI of each row in the last row Vian for sky:n, $s

2.N is a number, if N is., which indicates the start of the current line to the last row

:%s/vivian/sky/(equivalent to: G/VIVIAN/S//    :%s/vivian/sky/g (equivalent to: G/VIVIAN/S//  sky/g) Replace all Vivian in each row as Sky

3. You can use # as a delimiter, at which time the middle appears/does not act as a delimiter

: s#vivian/#sky/# Replace the current line the first vivian/is sky/ :

4. Replacement Confirmation

there are many times when a character (string) is required to be replaced in some position in the article, while other locations are not replaced by a selective operation, which requires the user to confirm, and the same support for the search substitution of VI For example: s/vivian/sky/G replaces the current line all Vivian for Sky in the command after the addition of a letter C can be achieved, that is: s/vivian/sky/gc as implies meaning, C is the abbreviation of Confirm

Vim Find/Replace string

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.