Vim has a built-in plugin named NetRW that acts as a file explorer to navigate directories and read-write files. I found that all the buffers used by NetRW to show directory listings would exist even after opening a file from them. This cluttered up my buffer list. Furthermore, while inside NetRW I could not close its buffer by using
From the many solutions offered, adding this line to
.vimrc worked for me:
autocmd FileType netrw setl bufhidden=wipe
Note that this still retains the very first buffer used by NetRW to show file listing. All the NetRW buffers that were created later, do not appear in the buffer list. Not a perfect solution, but I can live with it.
Another solution is to use the FileBeagle plugin instead of NetRW and Vinegar. It works the same as NetRW for viewing and opening files from a directory hierarchy. However, you cannot rename or delete files from it.
Tried with: Vim 7.4 and Ubuntu 14.04