Exit file explorer in Vim without closing

The command :bd (delete current buffer) appears to close an active file explorer without closing Vim, even if the explorer is full-screen.


This is expected behavior.

If you have an open modified file, :Explore will open a split-screen explorer, and typing :q will return to the opened file. If not, it will open a full-screen explorer, and :q will close vim.

If you want to force the split-screen explorer even when the opened file has not been modified, or if no file has been opened, use :Sexplore instead.

You can also use a tabbed full screen explorer with :Texplore, that probably behaves exactly the way you want. It will open the explorer on a new tab, and typing :q will always close that tab, but not vim.

Please take a look at the Vim documentation about these commands.


In Vim 8 (I haven't tried earlier versions) :Rexplore will work.

In :help :Explore it mentions:

:Rexplore            ... Return to/from Explorer

:Rexplore only actually works when you are in the Explorer.

:Lexplore is also a very nice option, as it will open the vertical explorer, but opening any file from there will open the file in your original window. Then you can close the explore window by typing :Lexplore again. This effectively then works similar to other file explorers like NERDTree or as in editors like Sublime Text. This is different behaviour from :Sexplore / :Vexplore / :Texplore which open the file in the same window as the Explorer.


:bd work, but if you're open NerdTree, this will close NerdTree and with :Rex, everything works perfectly.