Pavel Shevaev wrote:
On 2/25/07, Tim Chase <[EMAIL PROTECTED]> wrote:
> Grepping for something seems to be trivial with :vimgrep and :grep but
> there's nothing simple like this for 'search&replace' and i wonder
> why... Is it done intentionally or i'm just missing something?

Just missing the power of the argdo/windo/bufdo commands:

Thank you very much, i'm surely going to have a deep look at these
commands. BTW, is it possible(i don't have vim installed on this box)
to find something with :vimgrep and then use :argdo to replace? I'm
asking about this because IMHO opening ~500 files with "vim *.txt"
just to replace something in several files looks like an overkill, no?


You still have to open them in :vimgrep (:verbose shows that :vimgrep reads the viminfo for every file scanned so I guess it "opens" the files as for editing). What you can avoid is the rewrite of unchanged files, by using ":update" rather than ":w" after the substitute:

        :args *.txt
        :argdo %s/\<John\>/Jack/g |up

Best regards,
Tony.
--
Texas law forbids anyone to have a pair of pliers in his possession.

Reply via email to