Search and replace linux vim shortcut keys, linuxvim

Source: Internet
Author: User

Search and replace linux vim shortcut keys, linuxvim

Search

/Csdn: Find a string named csdn.

? Csdn looks up a string named csdn

N is an English letter, indicating to continue searching for the previous search.(Used with the above operations)

N is an English letter, indicating to continue the previous search operation.(Used with the above operations)


When case-insensitive search is performed, add \ c to the string to be searched, as shown below:

/Csdn \ c


Replace

: N1, n2s/word1/word2/g

N1 and n2 are numbers. Query word1 between n1 and n2 and replace this string with word2.

For example:

: 10, 20 s/csdn/good/g
The csdn string is replaced with good in the range of 10 to 20.

: 1, $ s/word1/word2/g
Replace word1 with word2 from the first row to the last row.


: 1, $ s/word1/word2/gc
Replace word1 with word2 from the first row to the last row. A prompt is displayed before replacement.


Note: Both search and replace operations are performed in non-edit mode.



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.