Search and replace in vim in specific lines

后端 未结 5 1289
时光取名叫无心
时光取名叫无心 2020-12-07 13:10

I can use

:5,12s/foo/bar/g

to search for foo and replace it by bar between lines 5 and 12. How can I do that only

5条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-07 13:29

    You could always add a c to the end. This will ask for confirmation for each and every match.

    :5,12s/foo/bar/gc
    

提交回复
热议问题