Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does NERDTree split or open a new panel seemingly randomly?

I love vim and NerdTree, but I'm sick of the fact that seemingly every time I try to open a file for viewing, half the time it get's rid of the old file I was editing and just opens it, and the other half splits the panel in half and makes me look at two pages.

Split screen would be useful on occasion, but I can't figure out why NERDTree does it sometimes or not. I'm just going over to the file in the tree and hitting enter. No idea what's going on, but it's a little annoying.

like image 397
Alexander Kleinhans Avatar asked Aug 06 '15 09:08

Alexander Kleinhans


1 Answers

If you use the command o and the current window contains a file that hasn't been edited, then the window content will be replaced with the new opened file. Otherwise a new split is opened (in order not to lose the current file modifications).

If you want to better control the NERDTree behavior, follow this cheat sheet:

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
like image 174
enrico.bacis Avatar answered Sep 19 '22 01:09

enrico.bacis