I recently switched to vim, and learnt that you can execute searching using AG.
I always do
:Ag foo
And, in the quicklist window
:cdo s/foo/bar/g |update
However,it opens all the files in buffers.How can I not let Vim open buffers,but let vim replace words?
use :cfdo and close all the buffers you've opened and modified:
:cfdo :bd
So the workflow is as follows:
:Ag foo
:cdo %s/bar/baz/g | update
:cfdo :bd
While :cdo iterates over each entry in the quickfix list, :cfdo moves over each file referenced in the list.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With