Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion bufdo and tabs
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Ben Fritz  
View profile  
 More options Nov 14 2012, 9:31 am
From: Ben Fritz <fritzophre...@gmail.com>
Date: Wed, 14 Nov 2012 06:31:37 -0800 (PST)
Local: Wed, Nov 14 2012 9:31 am
Subject: Re: bufdo and tabs

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 must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.