Close file without quitting VIM application?
As already mentioned, you're looking for :bd
, however this doesn't completely remove the buffer, it's still accessible:
:e foo
:e bar
:buffers
1 #h "foo" line 1
2 %a "bar" line 1
Press ENTER or type command to continue
:bd 2
:buffers
1 %a "foo" line 1
Press ENTER or type command to continue
:b 2
2 bar
You may instead want :bw
which completely removes it.
:bw 2
:b 2
E86: Buffer 2 does not exist
Not knowing about :bw
bugged me for quite a while.
This deletes the buffer (which translates to close the file)
:bd