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
bufdo and tabs
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
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
 
Roy Fulbright  
View profile  
 More options Nov 14 2012, 2:11 am
From: Roy Fulbright <rfulb...@hotmail.com>
Date: Wed, 14 Nov 2012 02:10:47 -0500
Local: Wed, Nov 14 2012 2:10 am
Subject: bufdo and tabs

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.                                          


 
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.
Marcin Szamotulski  
View profile  
 More options Nov 14 2012, 4:14 am
From: Marcin Szamotulski <msza...@gmail.com>
Date: Wed, 14 Nov 2012 09:13:36 +0000
Local: Wed, Nov 14 2012 4:13 am
Subject: Re: bufdo and tabs
On 02:10 Wed 14 Nov     , 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.                                      

> --
> 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

I think this is expected.  The bufdo command does the job in the current
window, and the last file it operates on is the c.txt.  Thus it will
leave it in the current window (see :help bufdo).  To avoid the E37
error you can also use:
    set hidden

Best,
    Marcin


 
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.
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

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.
Roy Fulbright  
View profile  
 More options Nov 14 2012, 10:22 am
From: Roy Fulbright <rfulb...@hotmail.com>
Date: Wed, 14 Nov 2012 10:21:36 -0500
Local: Wed, Nov 14 2012 10:21 am
Subject: RE: bufdo and tabs

 > Date: Wed, 14 Nov 2012 06:31:37 -0800

Thanks for the quick response. The :tabdo command is what I needed.                                      

 
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.
End of messages
« Back to Discussions « Newer topic     Older topic »