Find and replace strings in vim on multiple lines

前端 未结 11 1824
耶瑟儿~
耶瑟儿~ 2020-12-02 03:29

I can do :%s///g for replacing a string across a file, or :s///

11条回答
  •  我在风中等你
    2020-12-02 03:57

    In vim if you are confused which all lines will be affected, Use below

     :%s/foo/bar/gc  
    

    Change each 'foo' to 'bar', but ask for confirmation first. Press 'y' for yes and 'n' for no. Dont forget to save after that

    :wq
    

提交回复
热议问题