Find and Replace in Vim
Find and Replace in Vim
Syntax:
:[range]s[ubstitute]/{pattern}/{string}/[flags] [count]
Example:
- Replace all occurances of
nimalan
withmark
:%s/nimalan/mark/g
- Replace 4 occurances of
a
witho
:%s/a/o/g 4
:[range]s[ubstitute]/{pattern}/{string}/[flags] [count]
nimalan
with mark
:%s/nimalan/mark/g
a
with o
:%s/a/o/g 4