Use :bdel to close directory listing?

44 views
Skip to first unread message

Roland Freikamp

unread,
Oct 8, 2020, 6:40:00 PM10/8/20
to v...@vim.org
Hi,

in earlier ViM-versions, :bdel could be used to close directory listings,
and e.g. :bn could be used to switch away from the directory listing to
the next buffer.
But with newer versions, this unfortunately does not work anymore, which
makes it really cumbersome to e.g. view/edit all files in a directory by
"vim *".

Is there a way to fix this?
So, that I e.g. can do "vim *", and then close directory-listings with
":bdel" or switch away from a directory-listing by ":bn"?

best regards,
Roland

Christian Brabandt

unread,
Oct 9, 2020, 3:15:52 AM10/9/20
to v...@vim.org
Hm, indeed, it looks like you need to run :bd twice. Not sure what is
causing this. For me :bd! also works. You might want to contact Dr. Chip
about this issue.

Best,
Christian
--
Nur wer verzagend das Steuer losläßt, ist im Sturm verloren.
-- Emanuel Geibel

Charles Campbell

unread,
Oct 9, 2020, 3:47:20 PM10/9/20
to vim...@googlegroups.com, Roland Freikamp
Hello:

Let me explain why it is that the netrw buffer is (normally) hidden. 
Originally netrw was written to handle file transfers over the network
via ftp, ssh, etc, and it still does.  The next major feature was to
have netrw display and work with remote directories; Bram asked me to
have it do the same thing for local directories. Often enough one does
not have password-free setups to do remote work, and so one can get
pestered by the resulting need to have to enter passwords for every
remote listing/file transfer/etc. To facilitate this, netrw supports
"fastbrowse" (see :he g:netrw_fastbrowse) which keeps netrw listings
hidden rather than destroying them; subsequent requests to re-list a
directory then just bring up the appropriate hidden file instead.

See :he 'bh' and, while in a netrw listing, try :set bh; you'll find
that netrw has bh=hide. You can use :bd! to force a real deletion of a
directory as opposed to just hiding it.

Alternatively, you can put let g:netrw_fastbrowse=0 and :bd will then
truly delete the netrw buffer -- if you have v171a (or later) of netrw.
It was already supposed to be deletable when g:netrw_fastbrowse was
zero, but s:NetrwSafeSetting() needed an update to force that "safe"
setting for netrw buffers (hence v171a).

You can get v171a from my website:
http://www.drchip.org/astronaut/vim/index.html#NETRW .

Regards,
Chip Campbell

Dominique Pellé

unread,
Oct 9, 2020, 6:28:55 PM10/9/20
to Vim List
Charles Campbell <camp...@drchip.org> wrote:

> You can get v171a from my website:
> http://www.drchip.org/astronaut/vim/index.html#NETRW .

Hi Charles

The above URL and your website http://www.drchip.org/
do not work for me somehow. I get "The connection has
timed out". It does not look like a temporary outage, since
I remember trying a few weeks ago and it did not work either.
I cannot ping www.drchip.org either.

Regards
Dominique

Richard Mitchell

unread,
Oct 9, 2020, 7:34:57 PM10/9/20
to vim_use
Works for me.  DNS shows:

www.drchip.org is an alias for drchip.org.
drchip.org has address 67.23.226.159
drchip.org mail is handled by 0 drchip.org.

 

Charles Campbell

unread,
Oct 9, 2020, 10:19:19 PM10/9/20
to vim...@googlegroups.com
Richard's results look like what I see with nslookup:
www.drchip.org    canonical name = drchip.org.
Name:    drchip.org
Address: 67.23.226.159

That's been my website for years, too. Perhaps you can try traceroute and find out what's dropping the link.

Chip Campbell

Tony Mechelynck

unread,
Oct 10, 2020, 5:25:29 AM10/10/20
to vim_use
I just tried http://www.drchip.org/astronaut/vim/ (which has been for
years the link from my Vim page to Dr. Chip's) and it came up
immediately with no problem.

You might want to bookmark the site "Down for everyone or just for
me?" https://downforeveryoneorjustme.com/

Best regards,
Tony.

Tony Mechelynck

unread,
Oct 10, 2020, 5:30:17 AM10/10/20
to vim_use, Charles E. 'Dr. Chip' Campbell, Ph.D.
P.S. I can get (from Belgium) to Dr. Chip's site with no problem but
downforeveryoneorjustme.com cannot.

Best regards,
Tony.

Tony Mechelynck

unread,
Oct 10, 2020, 5:40:00 AM10/10/20
to vim_use
P.P.S. I tried to Cc Dr. Chip on the above message but I got a bounce:
"drchip wasn't found at campbellfamily.biz"

That message was headed "Office365" and its From: line was
postm...@ekghgbhkzak1qwzjttzjlplcfcx.onmicrosoft.com

Best regards,
Tony.

Richard Mitchell

unread,
Oct 11, 2020, 8:45:03 AM10/11/20
to vim_use
I am intrigued DrChip.org failed for your test site.  It worked for "me".

 

I wonder if the dns server i'm using had a long TTL.  Currently I show:

;; ANSWER SECTION:
drchip.org. 14374 IN A 67.23.226.159

so, I have 14374 seconds to go before it updates again.
However, as Chip as already weighed in, if he had recently changed
anything, he certainly would have said so and he didn't.

I want to make it clear I never doubted Dominque was having a real issue
and was hoping the IP address would give him a work around and something
to check against his own query.

campbellfamily.biz. 3600 IN A 66.96.149.21

uses a different registrar and name servers.  doesn't mean anything, just an observation.


Charles Campbell

unread,
Oct 11, 2020, 12:42:07 PM10/11/20
to vim...@googlegroups.com
Richard Mitchell wrote:
>
>
> On Saturday, October 10, 2020 at 5:40:00 AM UTC-4, Tony Mechelynck wrote:
>
> On Sat, Oct 10, 2020 at 11:29 AM Tony Mechelynck
> <antoine....@gmail.com <javascript:>> wrote:
> >
> > P.S. I can get (from Belgium) to Dr. Chip's site with no problem
> but
> > downforeveryoneorjustme.com <http://downforeveryoneorjustme.com>
> cannot.
> >
> > Best regards,
> > Tony.
>
> P.P.S. I tried to Cc Dr. Chip on the above message but I got a
> bounce:
> "drchip wasn't found at campbellfamily.biz
> <http://campbellfamily.biz>"
>
> That message was headed "Office365" and its From: line was
> postm...@ekghgbhkzak1qwzjttzjlplcfcx.onmicrosoft.com <javascript:>
>
> Best regards,
> Tony.
>
>
> I am intrigued DrChip.org failed for your test site.  It worked for "me".
>
> I wonder if the dns server i'm using had a long TTL.  Currently I show:
>
> ;; ANSWER SECTION:
> drchip.org.14374INA67.23.226.159
>
> so, I have 14374 seconds to go before it updates again.
> However, as Chip as already weighed in, if he had recently changed
> anything, he certainly would have said so and he didn't.
>
> I want to make it clear I never doubted Dominque was having a real issue
> and was hoping the IP address would give him a work around and something
> to check against his own query.
>
> campbellfamily.biz.3600INA66.96.149.21
>
> uses a different registrar and name servers.  doesn't mean anything,
> just an observation.
>
Some random thoughts in no particular order:

My email now is: Ncamp...@SdrPchip.AorgM-NOSPAM (ie. remove the NOSPAM
from the address).

It used to be drc...@campbellfamily.biz, though. I updated all the
syntax files I support with it but then I updated syntax/vim.vim, and my
script for the auto-generated portion hadn't been updated and I'm afraid
I didn't notice and so syntax/vim.vim got left with a stale address. 
I've fixed that just this past week.

I myself didn't know that the www. in www.drchip.org was optional. I
doubt that I can train my fingers to skip typing the www. .

14374 seconds -- well, that's only four hours!  What's the rush? :)

I just tried Tony's suggestion:https://downforeveryoneorjustme.com/
and it worked, both with www.drchip.org and with drchip.org.

Dominique -- did using the ip address directly help?  What did
traceroute show? Does nslookup get the ip address?

Regards,
Chip Campbell

Tony Mechelynck

unread,
Oct 11, 2020, 1:20:15 PM10/11/20
to vim_use
On Sun, Oct 11, 2020 at 6:42 PM Charles Campbell <camp...@drchip.org> wrote:
[…]
> My email now is: Ncamp...@SdrPchip.AorgM-NOSPAM (ie. remove the NOSPAM
> from the address).
>
> It used to be drc...@campbellfamily.biz, though. I updated all the
> syntax files I support with it but then I updated syntax/vim.vim, and my
> script for the auto-generated portion hadn't been updated and I'm afraid
> I didn't notice and so syntax/vim.vim got left with a stale address.
> I've fixed that just this past week.
[…]

Aha! Time to update my list of contacts then.

Best regards,
Tony.

Roland Freikamp

unread,
Mar 8, 2021, 4:52:32 PM3/8/21
to vim...@googlegroups.com
Hi,

since this is still really annoying me, I have to ask again, if there is
*any* solution.

> You can use :bd! to force a real deletion of a directory
> as opposed to just hiding it.
Unfortunately, this does not work. No matter how often I type ":bd",
":bd!", ":bn", ":bw", ... nothing happens.
(VIM 8.2, netrw v168)

Example:

- directory structure:

./dir/
./dir/subfile
./file

- vim *

Result:
- vim shows the "dir"-directory-listing, and there is no way to (a) delete
the buffer or (b) switch to the next buffer with :bd/:bn.
- :n switches to the next buffer, but does not cycle/wrap-around.
- The *only* way to close the directory-listing, is:
- :buffers
- look for the buffer-numer
- :bdel <num>
- :bn
In earlier vim-versions, :bdel was enough.

So, is there *any* way to solve this, so that :bdel (or some other command)
closes the directory listing and switches to the next buffer?
(Or maybe a way to prevent "vim *" to open directory listings at all?)


Thanks,
Roland

Charles Campbell

unread,
Mar 8, 2021, 9:39:42 PM3/8/21
to Roland Freikamp
Well, I just don't see that problem.

vim *
shows the dir/ and its file,
:bn then moves on to "file".

Repeating, and instead of :bn I used :bd -- and the "file" is opened
with contents shown.

Perhaps upgrading netrw would be of assistance in this; its at 171g
(v170 should be available as a regular vim update, and 171g is available
from my website as http://www.drchip.org/astronaut/vim/index.html#NETRW).

Regards,
Chip Campbell

Roland Freikamp

unread,
Mar 9, 2021, 12:04:19 PM3/9/21
to vim...@googlegroups.com
Hi,

thanks for your answer. Unfortunately, it does not work here,
even after upgrading to netrw v171g.

> Well, I just don't see that problem.
>
> vim *
> shows the dir/ and its file,
> :bn then moves on to "file".
>
> Repeating, and instead of :bn I used :bd -- and the "file" is opened with
> contents shown.
This does not work here -- :bn and :bd do absolutely nothing.
It looks like this does not work when "set hidden" is used. :(

So: Is there any way to use "set hidden" (which I need, since I want to
edit several files simultaneously), and being able to switch away/close
directory listings with :bn/:bd or some other command?

> Perhaps upgrading netrw would be of assistance in this; its at 171g (v170
> should be available as a regular vim update, and 171g is available from my
> website as http://www.drchip.org/astronaut/vim/index.html#NETRW).
Unfortunately not.


Best regards
Roland

Roland Freikamp

unread,
Mar 24, 2021, 3:27:54 PM3/24/21
to vim...@googlegroups.com
Hi,

so, there is no way to prevent netrw from breaking the :bn/:bdel
behaviour? Will this netrw-bug be solved soon?

Until then, the only way seems to completely diable netrw, e.g. by
let g:loaded_netrw=1


Best regards
Roland
> --
> --
> 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 vim_use+u...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20210309170411.GA23840%40localhost.

Chris Allison

unread,
Mar 26, 2021, 3:03:07 AM3/26/21
to vim
Hi Roland,

You probably don't want to hear this, but :bn, :bd etc work as expected here.
Have you any script or plugin that may be overriding the usage of the :b* commands?
try starting vim with
```
vim --clean *
```
to see if the commands work now.



--
regards

Chris Allison
Reply all
Reply to author
Forward
0 new messages