Avoid Vim by keeping closed buffers open in the background

After completely rebuilding my Vim environment using various standard extensions, there is one behavior that annoys me a lot:

When I open a file in a split window and close that window again (": wq"), Vim seems to keep the file buffer open in the background. When I now try to open the file on a different shell tab in a new Vim instance, the swap file still exists, which prevents me from editing the file.

I assume there is a parameter that forces Vim to keep the buffers open but hidden when I close the split, but I could not find out which one it is. I really want Vim to really close buffers when I close splits so that I can reopen the corresponding files in a parallel Vim session.

I expect the buffer to close as soon as the last window showing it closes through ": q".

+5
source share
4 answers

hidden :set hidden?. vim nohidden, , ; , ( , ). , hidden, , ; .

:help 'hidden' .

+7

, . .

. script, , , .

, , .

+2

I am not sure how you close the split, for example, using Ctrl W Ctrl oin another window or Ctrl W Ctrl q, but I don’t think this should close the buffer as well. Partitioning is just a windowing method, not a buffer.

If in a split you want to close the buffer and its window, why not use it :bd? It obviously closes the buffer.

0
source

You are looking for :bw[ipeout].

0
source

All Articles