Is it possible to interactively delete matching search pattern in Vim?

前端 未结 4 1336
暗喜
暗喜 2021-01-30 04:01

There is a phrase that I want to look for in Vim. When found, I want to delete that occurrence of the phrase. What is the easiest way to cycle through all the occurrences (via <

4条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-30 04:35

    http://vim.wikia.com/wiki/Search_and_replace

    Try this search and replace:

    :%s/foo/bar/gc
    

    Change each 'foo' to 'bar', but ask for confirmation first.

    Press y or n to change or keep your text.

提交回复
热议问题