On Wednesday, November 14, 2012 1:11:20 AM UTC-6, Roy Fulbright wrote:
> I'm using gvim 7.3.600 on Windows 7.
>  
> I have three files opened in tabs (tab1=a.txt, tab2=b.txt, tab3=c.txt).
> All three files contain the string 'abc'.
>  
> When I use :bufdo :%s/abc/def/ I get message E37: No write since last
> change (add ! to override).
>  
> When I use :bufdo! :%s/abc/def/ all files are changed, but
> now tab1 and tab3 both contain c.txt. What happened to a.txt in tab1?
>  
> If I do :wa then exit and look at the files, all three files are changed.
> It's tab1 displaying the same file as tab3 after the :bufdo! that's puzzling.
>  
> Is this a bug or am I missing something regarding bufdo and tabs?
>  
> Thanks.

It's not a bug. I think you may be missing something regarding windows, tabs, 
and buffers. http://vim.wikia.com/wiki/Buffers has a nice overview.

It sounds like you expect bufdo to operate on all TABS in your Vim, rather than 
all BUFFERS, and you just happen to have a single window open in each tab with 
a different buffer in each case. The :tabdo command will be close to what you 
want but if you have multiple windows in a tab or a tab with a duplicate buffer 
it still may do something unexpected. If you know you have exactly one window 
per tab with a unique buffer in each window, there will be no problem.

You can also open up a tab containing all open buffers and run a windo on that 
tab:

:tabnew
:sball
:windo WhateverCommandYouWant

-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Reply via email to