Celeb Glow
news | March 30, 2026

Exiting the file explorer in vim

I know to enter the file explorer in vim( by typing :e .). I am not sure how to exit the file explorer in vim. I typed :q and it gave me a segmentation fault. What should be the correct way to exit the file explorer in vim?

1

2 Answers

:q should work just as fine with the "file explorer" as with any other open buffers. A segmentation fault suggests there's a serious bug in the version of vim you are using (or it could be a kernel bug or faulty RAM).

I tried this myself, but did not get a segmentation fault.

3

I open the file explorer in the same buffer as the file by default using vim-vinegar.

I've managed to map Esc to delete the file explorer buffer and return me to the file I was editing, by putting this in .vimrc:

autocmd FileType netrw nmap <silent> <buffer> <Esc> :BD<cr>

:BD is a command supplied by the BufKill.vim plugin. You can just use :bd if you want to close the buffer normally.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy