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.