On 7/11/06, Tim Chase <[EMAIL PROTECTED]> wrote:
> Hello all.  I have several files where I want to make the same
> substitution.  I can make the substitute command work on a single
> file, but I want to make it work on all the files.  I have the files
> loaded in buffers in vim.  Any suggestions?

Sounds like you're looking for bufdo (and perhaps later down the
line, its cousins "argdo" and "windo", and the newly minted "tabdo")

You either need to write the file after each change before
leaving the buffer, or you have to set the 'hidden' setting so
you can proceed to other buffers:

Method 1)

        :bufdo %s/foo/bar/g | update

Method 2)

        :set hidden
        :bufdo %s/foo/bar/g
(review your work here)
        :wall
(to write all the changes)

You can learn more at

        :help bufdo
        :help argdo
        :help windo
        :help 'hidden'

-tim


Wow!  Three responses almost immediately, that's incredible.  Thanks
for the help, I knew there would be a way to do it, I just wasn't sure
how to find it.
Thanks,
Jeremy

Reply via email to