Find and Replace within selection in `vi`

前端 未结 6 1607
不知归路
不知归路 2021-01-30 08:09

How do I do a Find and Replace within a selection in vi?

6条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-30 08:31

    If you want to do a global search and replace (with optional regexes) for all instances in the file, I would do the following:

    :%s/foo/bar/g
    

    Omit the g to do a local replace.

提交回复
热议问题