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