Unlisted buffers, bdelete vs bwipeout

60 views
Skip to first unread message

dcarroll

unread,
Nov 18, 2008, 8:32:10 AM11/18/08
to vim...@googlegroups.com
Hello,

I'm struggling to understand the subtle nuances of buffers.

bdelete - deletes a buffer from the buffer list, and adds it to the
top-secret unlisted buffer list.

bwipeout - the documentation says "Like "bdelete, but really delete the
buffer. . . Don't use this unless you know what you are doing".

1. Can somebody please elaborate on the difference between the two commands?

ie. under what circumstances would you say "Darn, I should have heeded
the documentation and used bdelete instead of bwipeout. But no, I
wouldn't listen...and now look at the mess I'm in."

2. Can somebody provide an example of how an unlisted buffer might be
useful?

Eg. type :ls! to see a list of buffers I deleted earlier, thus providing
a nice history of the files I worked with during this editing session.
Am I right? Any other examples?

Sincerely,

-- Dennis

Xavier de Gaye

unread,
Nov 18, 2008, 3:46:32 PM11/18/08
to vim...@googlegroups.com
On Tue, Nov 18, 2008 at 2:32 PM, dcarroll <den...@rubgrp.com> wrote:
>
> Hello,
>
> I'm struggling to understand the subtle nuances of buffers.
>
> bdelete - deletes a buffer from the buffer list, and adds it to the
> top-secret unlisted buffer list.
>
> bwipeout - the documentation says "Like "bdelete, but really delete the
> buffer. . . Don't use this unless you know what you are doing".
>
> 1. Can somebody please elaborate on the difference between the two commands?

The buffer marks are not lost after a bdelete, they are lost after a
bwipeout.


> ie. under what circumstances would you say "Darn, I should have heeded
> the documentation and used bdelete instead of bwipeout. But no, I
> wouldn't listen...and now look at the mess I'm in."
>
> 2. Can somebody provide an example of how an unlisted buffer might be
> useful?

Unlisted buffers are not saved by ':mksession', this is useful.


Xavier

Tony Mechelynck

unread,
Nov 18, 2008, 10:57:37 PM11/18/08
to vim...@googlegroups.com
On 18/11/08 21:46, Xavier de Gaye wrote:
> On Tue, Nov 18, 2008 at 2:32 PM, dcarroll<den...@rubgrp.com> wrote:
>> Hello,
>>
>> I'm struggling to understand the subtle nuances of buffers.
>>
>> bdelete - deletes a buffer from the buffer list, and adds it to the
>> top-secret unlisted buffer list.
>>
>> bwipeout - the documentation says "Like "bdelete, but really delete the
>> buffer. . . Don't use this unless you know what you are doing".
>>
>> 1. Can somebody please elaborate on the difference between the two commands?
>
> The buffer marks are not lost after a bdelete, they are lost after a
> bwipeout.

which is an advantage if you reload the deleted buffer: e.g. no need to
reload the viminfo file in search of marks (including the latest cursor
location).

>
>
>> ie. under what circumstances would you say "Darn, I should have heeded
>> the documentation and used bdelete instead of bwipeout. But no, I
>> wouldn't listen...and now look at the mess I'm in."
>>
>> 2. Can somebody provide an example of how an unlisted buffer might be
>> useful?
>
> Unlisted buffers are not saved by ':mksession', this is useful.
>
>
> Xavier

Well, wiped-out buffers are not saved either of course (Vim has
forgotten all about them), so this can hardly be called an advantage of
deleting compared to wiping out. For that, see under §1.


Best regards,
Tony.
--
Eighty percent of air pollution comes from plants and trees.
-- Ronald Reagan, famous movie star

Reply all
Reply to author
Forward
0 new messages