Keeping a scratch open, and opening into that scratch in vim

777 Views Asked by At

I have a preferred behavior in vim that I haven't been able to duplicate since switching over:

I'm using two great plug ins, NERDTree and MiniBufExplorer. When I open vim, I have NERDTree already open. When I open more than one file, MBE opens. This is great.

When I :bd or d (from MBE) to close buffers, they go away. This is also good, until I get to the last one. Typically deleting the last buffer would expand NERDTree from its nice ~15% width to 100%. Awful! So I found this function that makes a scratch buffer if you've closed the last real buffer, to maintain window appearances. This is awesome.

Now the final step: When I open a new file from the still-open NERDTree window, I end up with this layout:

NNN|Scratch
NNN|Scratch
NNN|Scratch
NNN|-------
NNN|NewFile
NNN|NewFile
NNN|NewFile

Is there a way to get my newly opened filed to bump/displace/close the scratch file that was taking up space there? I'm looking to fully replicate the IDE experience, only with the awesomeness and cache that comes with using vim.

Thanks for any thoughts.

1

There are 1 best solutions below

0
On

I don't use NERDTree, but the answer to this question looks vaguely relevant: Open file from NERDtree in specific window (or last active).