Open file from NERDtree in specific window (or last active)
Asked Answered
E

1

9

In VIM I've got 4 windows opened and a NERD tree like this: screenshot So, whenever I try to open the file from NERD, it's opened in first buffer (topleft pos). Sometimes in other buffers. Is there a way to open a file in bottom right position ? Mb there are workarounds ? Maybe I can force NERDtree to open file in last active window ? At the moment, it doesn't work this way :(

UPD: It looks like the problem is in hidden buffers. When the buffer was opened in one window, and then replaced by another - if you try to open the very first in another window, you'll get it opened in the window it was opened in the very first time.

Emera answered 31/8, 2010 at 9:27 Comment(0)
L
7

I'm using NERD tree 4.1.0 on Vim 7.2 and NERDTree does open files in the last active window by default.

From the docs:

Default key: o

Map option: NERDTreeMapActivateNode

Applies to: files and directories.

If a file node is selected, it is opened in the previous window.

But hitting enter when the file is selected has the same effect.

Lek answered 31/8, 2010 at 9:46 Comment(2)
For some reason, in the latest version of NERDTree this behavior no longer works -- it always seems to jump to an already open buffer of that file rather than opening in the previous window. Has anyone else noticed this?Ripple
I noticed that installing golden-ratio will break this behavior. @AaronGibralterRiggle

© 2022 - 2024 — McMap. All rights reserved.