Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

share|improve this question
2  
Since q at the : prompt quits vi, this is a bug. I recommend reporting this. (1) Read the bug reporting documentation for Ubuntu. (2) Make sure Apport is enabled. (3) If you're running Ubuntu 12.04, reconfigure Apport to report bugs from crashes (you can undo this after). (4) Reproduce the crash. –  Eliah Kagan Jul 1 '12 at 11:52
add comment

2 Answers 2

up vote 4 down vote accepted

: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.

share|improve this answer
    
:quit also worked... which is correct? –  lakesh Jul 1 '12 at 11:53
    
@lakesh :quit and :q is the exact same command. The latter is just the short version of the former. See :help quit –  geirha Jul 1 '12 at 11:55
    
@lakesh Does the segmentation fault occur with :q but not :quit?! –  Eliah Kagan Jul 1 '12 at 11:55
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.