Find and replace Linux vim using shortcut keys

Source: Internet
Author: User

Find

/csdn down to find a string called CSDN

? Csdn up to find a string called CSDN

n N is the English letter, which means to continue looking down the previous find Operation (in conjunction with the above operation)

n N is the English letter, which means to continue looking up the previous find Operation (in conjunction with the above operation)


Replace

: n1,n2s/word1/word2/g

N1 and N2 are numbers. Represents the query word1 between N1 and N2 rows and replaces the string with Word2.

For example:

: 10,20s/csdn/good/g
represents between 10 and 20 rows, replacing the CSDN string with a good

: 1, $s/word1/word2/g
represents the word1 from ground 1 to the last row, replacing the Word2


: 1, $s/word1/word2/gc
represents a row from ground 1 to the last row, replaces Word1 with Word2, and prompts for replacement before replacing it.


Note: Both find and replace are performed in non-edit mode



Find and replace Linux vim using shortcut keys

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.