Quantcast

bufdo reload and go to end of file

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

bufdo reload and go to end of file

Jorg Heymans
Hi,

I have a bunch of files open and I would like to refresh them all and jump to end of file. I tried various variations on:

:bufdo e|normal G

Can someone enlighten me on the correct syntax ? I'm using gvim 7.4.

Thanks,
Jorg

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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Fame!

arocker

I think this https://xkcd.com/1823/# is apropos for this list. :-)*

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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Fame!

Russell Urquhart

I personally think every piece of software should come with Vim keybindings!

(But that's just me!) ;)


Russ


On Thu, Apr 13, 2017 at 08:47:21AM -0400, [hidden email] wrote:

>
> I think this https://xkcd.com/1823/# is apropos for this list. :-)*
>
> --
> --
> 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
>
> ---
> You received this message because you are subscribed to the Google Groups "vim_use" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
> For more options, visit https://groups.google.com/d/optout.

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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Fame!

Peter King
On Thu, Apr 13, 2017 at 09:43:36AM -0500, Russell Urquhart wrote:
 
> I personally think every piece of software should come with Vim keybindings!
>
> (But that's just me!) ;)

No it isn't -- it's me too!

--
Peter King [hidden email]
Department of Philosophy
170 St. George Street #521
The University of Toronto    (416)-978-3311 ofc
Toronto, ON  M5R 2M8
       CANADA

http://individual.utoronto.ca/pking/

=========================================================================
GPG keyID 0x7587EC42 (2B14 A355 46BC 2A16 D0BC  36F5 1FE6 D32A 7587 EC42)
gpg --keyserver pgp.mit.edu --recv-keys 7587EC42

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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Fame!

Cesar Romani-2
On 13/04/2017 11:43 a.m., Peter King wrote:
> On Thu, Apr 13, 2017 at 09:43:36AM -0500, Russell Urquhart wrote:
>
>> I personally think every piece of software should come with Vim keybindings!
>>
>> (But that's just me!) ;)
>
> No it isn't -- it's me too!
>

It's me too!

--
Cesar

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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
BPJ
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Fame!

BPJ


Den 13 apr 2017 19:11 skrev "Cesar Romani" <[hidden email]>:
On 13/04/2017 11:43 a.m., Peter King wrote:
On Thu, Apr 13, 2017 at 09:43:36AM -0500, Russell Urquhart wrote:

I personally think every piece of software should come with Vim keybindings!

(But that's just me!) ;)

No it isn't -- it's me too!


It's me too!

CRISPR is not an ordinary editor though


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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: bufdo reload and go to end of file

Ben Fritz
In reply to this post by Jorg Heymans
On Wednesday, April 12, 2017 at 8:18:58 PM UTC-5, Jorg Heymans wrote:

> Hi,
>
> I have a bunch of files open and I would like to refresh them all and jump to end of file. I tried various variations on:
>
> :bufdo e|normal G
>
> Can someone enlighten me on the correct syntax ? I'm using gvim 7.4.
>
> Thanks,
> Jorg
Back on-topic: when you say you "have a bunch of files open", are they all in buffers that you are switching between in a single window? Or do you have them open in multiple windows? What happens when you run your command? What did you expect to happen instead?

I would expect your command to end with the last buffer loaded in your window, with the cursor at the end. If you have appropriate autocmds defined, switching back to another buffer in the same window would have the cursor on the last line, however without a "restore last position" autocmd it would probably just go back to the beginning of the file. The 'hidden' option may help there, I'm not 100% sure.

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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: bufdo reload and go to end of file

Jorg Heymans
On Friday, April 14, 2017 at 6:57:03 PM UTC+2, Ben Fritz wrote:

> Back on-topic: when you say you "have a bunch of files open", are they all in buffers that you are switching between in a single window? Or do you have them open in multiple windows? What happens when you run your command? What did you expect to happen instead?

they are in buffers in the same windows, a "bunch" i meant 3-4 split horizontally. When i run the command only the buffer that happened to have the cursor in it (the active buffer?) is positioned at the end of the file. All of them are reloaded though. What I expected to happen is all files to be refreshed with all buffers showing the last couple of lines of each file.

>
> I would expect your command to end with the last buffer loaded in your window, with the cursor at the end. If you have appropriate autocmds defined, switching back to another buffer in the same window would have the cursor on the last line, however without a "restore last position" autocmd it would probably just go back to the beginning of the file. The 'hidden' option may help there, I'm not 100% sure.

I did try the hidden option. did not seem to make a difference. Note that when i open the files in tabs and do the same with :tabdo everything works fine.

I will read up on autocmds, still ascending on the learning curve  :-)

Thanks for the help!
Jorg

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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: bufdo reload and go to end of file

Bram Moolenaar

Jorg Heymans wrote:

> On Friday, April 14, 2017 at 6:57:03 PM UTC+2, Ben Fritz wrote:
>
> > Back on-topic: when you say you "have a bunch of files open", are they al=
> l in buffers that you are switching between in a single window? Or do you h=
> ave them open in multiple windows? What happens when you run your command? =
> What did you expect to happen instead?
>
> they are in buffers in the same windows, a "bunch" i meant 3-4 split horizo=
> ntally. When i run the command only the buffer that happened to have the cu=
> rsor in it (the active buffer?) is positioned at the end of the file. All o=
> f them are reloaded though. What I expected to happen is all files to be re=
> freshed with all buffers showing the last couple of lines of each file.
>
> >=20
> > I would expect your command to end with the last buffer loaded in your wi=
> ndow, with the cursor at the end. If you have appropriate autocmds defined,=
>  switching back to another buffer in the same window would have the cursor =
> on the last line, however without a "restore last position" autocmd it woul=
> d probably just go back to the beginning of the file. The 'hidden' option m=
> ay help there, I'm not 100% sure.
>
> I did try the hidden option. did not seem to make a difference. Note that w=
> hen i open the files in tabs and do the same with :tabdo everything works f=
> ine.
>
> I will read up on autocmds, still ascending on the learning curve  :-)

Perhaps all you need is:

        windo $

--
GUARD #1:  What, ridden on a horse?
ARTHUR:    Yes!
GUARD #1:  You're using coconuts!
ARTHUR:    What?
GUARD #1:  You've got two empty halves of coconut and you're bangin' 'em
           together.
                                  The Quest for the Holy Grail (Monty Python)

 /// Bram Moolenaar -- [hidden email] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: bufdo reload and go to end of file

Ben Fritz
In reply to this post by Jorg Heymans
On Friday, April 14, 2017 at 12:51:02 PM UTC-5, Jorg Heymans wrote:
> On Friday, April 14, 2017 at 6:57:03 PM UTC+2, Ben Fritz wrote:
>
> > Back on-topic: when you say you "have a bunch of files open", are they all in buffers that you are switching between in a single window? Or do you have them open in multiple windows? What happens when you run your command? What did you expect to happen instead?
>
> they are in buffers in the same windows, a "bunch" i meant 3-4 split horizontally. When i run the command only the buffer that happened to have the cursor in it (the active buffer?) is positioned at the end of the file. All of them are reloaded though. What I expected to happen is all files to be refreshed with all buffers showing the last couple of lines of each file.
>

OK, so you *don't* have the buffers open in the same window, switching between them with buffer commands like ":b" or ":bprev" or ":bnext". You have several buffers open in multiple split windows.

The ":bufdo" command works by cycling through all the buffers open in Vim, loading them one by one in the current window. It does not affect the other split windows.

At the moment you visit any given buffer, it is now open in *two* windows: the currently active window, and the window you already had it open in. You reload the buffer, which affects both windows, because both windows are different views on the *same* buffer. Then you jump to the end of the buffer. This only affects the cursor position in the *current* window. The existing window is not affected. Then, you move on to the next buffer, so it appears that only the reload happened.

As Bram suggests, you probably actually wanted to use ":windo" instead of ":bufdo".

There's a good overview image here that may clear things up a little: http://vim.wikia.com/wiki/Buffers

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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: bufdo reload and go to end of file

Jorg Heymans
On Tuesday, April 18, 2017 at 4:31:28 AM UTC+2, Ben Fritz wrote:

> On Friday, April 14, 2017 at 12:51:02 PM UTC-5, Jorg Heymans wrote:
> > On Friday, April 14, 2017 at 6:57:03 PM UTC+2, Ben Fritz wrote:
> >
> > > Back on-topic: when you say you "have a bunch of files open", are they all in buffers that you are switching between in a single window? Or do you have them open in multiple windows? What happens when you run your command? What did you expect to happen instead?
> >
> > they are in buffers in the same windows, a "bunch" i meant 3-4 split horizontally. When i run the command only the buffer that happened to have the cursor in it (the active buffer?) is positioned at the end of the file. All of them are reloaded though. What I expected to happen is all files to be refreshed with all buffers showing the last couple of lines of each file.
> >
>
> OK, so you *don't* have the buffers open in the same window, switching between them with buffer commands like ":b" or ":bprev" or ":bnext". You have several buffers open in multiple split windows.
>
> The ":bufdo" command works by cycling through all the buffers open in Vim, loading them one by one in the current window. It does not affect the other split windows.
>
> At the moment you visit any given buffer, it is now open in *two* windows: the currently active window, and the window you already had it open in. You reload the buffer, which affects both windows, because both windows are different views on the *same* buffer. Then you jump to the end of the buffer. This only affects the cursor position in the *current* window. The existing window is not affected. Then, you move on to the next buffer, so it appears that only the reload happened.
>
> As Bram suggests, you probably actually wanted to use ":windo" instead of ":bufdo".
>
> There's a good overview image here that may clear things up a little: http://vim.wikia.com/wiki/Buffers
Indeed "windo e|normal G" or "windo e|$" works. I am going to have a good look on what buffers actually are, thanks for the link !

Jorg

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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Loading...