How do I reset the splits in Vim?

513 views Asked by At

I'm using MiniBufExplorer and NERD tree to develop in Vim. I usually have the following screens:

MMMMMMMMMMMM
NNSSSSSSSSSS
NNSSSSSSSSSS
NNSSSSSSSSSS
NNSSSSSSSSSS
NNSSSSSSSSSS

where N is NERD tree, M is MiniBufExplorer and S is the file I'm looking at.

I sometimes forget to use :sh to get to a shell, and I hit :q on the S split, which makes it so toggling NERD tree will either make a full-screen NERD tree split or a full screen source view, but never where it was before where NERD tree was off to the left (MiniBufExplorer doesn't change).

How can I "reset" the splits to get the old behavior back after that? I've basically been doing :qa to completely exit Vim, but obviously that closes everything.

2

There are 2 answers

0
Andy Ray On

not a direct answer to your question, but maybe something that will solve your problem:

https://github.com/jistr/vim-nerdtree-tabs

"When you close a file, the tab closes with it. No NERDTree hanging open."

Nerdtree is just the worst thing to deal with. That plugin-for-a-plugin makes it bearable.

0
ngm On

You could try using sessions - make a session of your setup with

mksession

and restore it with

source Session.vim

if your splits get mucked up.

Think you'll need to use the session.vim plugin though if NERDTree is involved: see Vim, NERDtree not recovered in session restore.