How do I convince nerdtree to open file in current window
Asked Answered
M

2

7

I want to use o to open a file that may already be open in some other tab within my VI session. It always jumps to the tab where the file is open. Is there some way to stop this and just duplicate the file in the current tab/split?

Moneybags answered 21/10, 2014 at 15:40 Comment(1)
Do you specifically need to use o? I believe using s or t instead might have the desired functionality. If you need to use o you could remap it to the function called by pressing s or t. Not sure how to do that quite yet, but will update with an answer when I do.Logrolling
L
4

Add this to your .vimrc

let g:NERDTreeMapActivateNode = ''
let g:NERDTreeMapOpenInTab = 'o'

Note that hitting Enter now calls the function that pressing o originally called by default. Also, it will open the file in a new tab even when no file is being viewed.

I would recommend just using t or s.

Logrolling answered 4/5, 2015 at 4:23 Comment(1)
Using s worked to me, I prefer to open files in the same view that NERDTree is opened.Antilepton
C
1

Add this to your .vimrc

let g:NERDTreeMapActivateNode = 'go'
let g:NERDTreeMapPreview = 'o'
Caramel answered 8/5, 2019 at 13:44 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.