Why does NERDTree split or open a new panel, seemingly by accident?

I love vim and NerdTree, but I'm sick of the fact that every time I try to open a file for viewing, half the time it gets rid of the old file that I edited and just opens it and the other half breaks the panel in half and makes me take a look at two pages.

A split screen would be useful sometimes, but I cannot understand why NERDTree does this sometimes or not. I just go to the file in the tree and fall into it. I don’t know what’s going on, but it’s a little annoying.

+6
source share
1 answer

If you use the o command and the current window contains a file that has not been edited, the contents of the window will be replaced with the new open file. Otherwise, a new section opens (so as not to lose the current file modifications).

If you want to better control NERDTree behavior, follow this trick:

 o: open in prev window go: preview t: open in new tab T: open in new tab silently i: open split gi: preview split s: open vsplit gs: preview vsplit 
+8
source

All Articles