Alexander Kleinhans
Alexander Kleinhans

Reputation: 6258

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.

Upvotes: 10

Views: 4847

Answers (1)

enrico.bacis
enrico.bacis

Reputation: 31524

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

Upvotes: 14

Related Questions