How to do search & replace with ack in vim?

后端 未结 5 483
天命终不由人
天命终不由人 2020-12-07 08:43

I am using the Ack plugin in Vim, which helps me to quickly search for strings in my project. However, sometimes I want to replace all or some occurrences of the found strin

5条回答
  •  天命终不由人
    2020-12-07 09:35

    I use MacVim (activated with mvim in a shell). I pipe the results of ack to mvim:

    mvim -f $(ack -l $@)
    

    Then in MacVim, I search/replace using bufdo:

    :bufdo %s/SEARCH/REPLACE/gce | update
    

    Omit the c option if confirmation is not needed.

提交回复
热议问题