Friday, January 1, 2010

Re: bufdo broken in 7.2.325?

On 02/01/10 01:35, Chris Sutcliffe wrote:
> Hi All,
>
> I was in the process of updating the copyright date for a whole bunch
> of my source files that I had open in buffers in vim. I tried:
>
> :bufdo %s/2009/2010/ge
>
> All it did was update the first buffer. I executed:
>
> :tab sball
>
> to get all the buffers into tabs and executed:
>
> :tabdo %s/2009/2010/ge
>
> and it worked just fine. Did I do something wrong with bufdo, or is it broken?
>
> I'm running vim 7.2.325 in Cygwin on Windows XP Pro.
>
> Cheers!
>
> Chris
>

Unless you have 'hidden' 'autowrite' or 'autowriteall' set, your first
command will refuse to |abandon| the modified buffer (see ":help
abandon"). You should have done:

:bufdo %s/2009/2010/ge |update

-- and BTW, beware that the above will also change 120090 to 120100.

With every buffer in a different tab (or in a different window), :tabdo
or :windo doesn't have the same problem, which explains why your second
command worked.


Best regards,
Tony.
--
Xerox never comes up with anything original.

--
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php

No comments: