Interactive search/replace regex in Vim?

前端 未结 7 2033
夕颜
夕颜 2020-12-12 10:05

I know the regex for doing a global replace,

     %s/old/new/g

How do you go about doing an interactive search-replace in Vim?

7条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-12 10:22

    If you just want to count the number of occurrences of 'abc' then you can do %s/abc//gn. This doesn't replace anything but just reports the number of occurrences of 'abc'.

提交回复
热议问题