Friday, October 9, 2020

Re: Use :bdel to close directory listing?

Roland Freikamp wrote:
> 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"?
>
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

--
--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/dc404e87-8692-032f-a37f-219b5a988986%40drchip.org.

No comments:

Post a Comment