I first open a directory in Vim. Then I browse it and open a file. After I'm done with a file, I close it, whether by :w
or :bd
or :q
-- doesn't matter, and I expect to come back the same buffer where I were initially -- the directory. But when I close the file, it also quits Vim. How can I just close that file and return to the initial buffer with the directory?
Asked
Active
Viewed 35 times
0
-
Have you read [this](http://vim.wikia.com/wiki/Restore_cursor_to_file_position_in_previous_editing_session)? – Ruslan Osmanov Jan 14 '17 at 02:31
-
Isn't this really a duplicate of: http://stackoverflow.com/questions/3914969/how-to-make-vims-file-browser-open-a-file-in-a-new-buffer – gregory Jan 16 '17 at 20:42
1 Answers
1
:w
should be :wq
.
Anyway, you don't need to "close" that buffer. Just go back to the file listing with :b#
, or <C-^>
, or :Rex[plore]
.
If you absolutely need to "close" that buffer you can go back to the listing with :b#
(#
represents the previous buffer) and close that unwanted buffer with :bd#
. In short:
:b#|bd#

romainl
- 186,200
- 21
- 280
- 313