I open many files to Vim by
vim a/*.php
This opens 23 files.
I made my edit and run the following twice
:q
It closes all my buffers.
How can you close only one buffer in Vim?
I open many files to Vim by
vim a/*.php
This opens 23 files.
I made my edit and run the following twice
:q
It closes all my buffers.
How can you close only one buffer in Vim?
You can use the :n
command to move to the next file. :prev
goes to the previous file.
How about
vim -O a a
That way you can edit a single file on your left and navigate the whole dir on your right... Just a thought, not the solution...
Check your buffer id using :buffers
you will see list of buffers there like
1 a.php
2 b.php
3 c.php
if you want to remove b.php from buffer
:2bw
if you want to remove/close all from buffers
:1,3bw
:ls = list buffers
:bd#n = close buffer where #n is the buffer number (use ls to get it)
example: delete buffer 2
:bd2
If this isn't made obvious by the the previous answers:
:bd will close the current buffer. If you don't want to grab the buffer list.
A word of caution: "w does not stand for write but for wipeout!"
More from manuals:
:bw
Like |:bdelete|, but really delete the buffer.
:bd
Unload buffer [N] (default: current buffer) and delete it from the buffer list. If the buffer was changed, this fails, unless when [!] is specified, in which case changes are lost. The file remains unaffected.
Maybe switch to using tabs?
vim -p a/*.php
opens the same files in tabs
gt
and gT
switch tabs back and forth
:q
closes only the current tab
:qa
closes everything and exits
:tabo
closes everything but the current tab