Skip to content
This repository has been archived by the owner on Apr 5, 2024. It is now read-only.

Adding a mapping with NERDTreeAddKeyMap makes toggling nerdtree cycle through all tabs #66

Open
AndrewRayCode opened this issue Feb 26, 2015 · 3 comments

Comments

@AndrewRayCode
Copy link

I added this to my .vimrc:

call NERDTreeAddKeyMap({
        \ 'key': 'b',
        \ 'callback': 'NERDTreeEchoCurrentNode',
        \ 'quickhelpText': 'echo full path of current node' })

function! NERDTreeEchoCurrentNode()
    let n = g:NERDTreeFileNode.GetSelected()
    if n != {}
        echomsg 'Current node: ' . n.path.str()
    endif
endfunction

Then I opened and closed NERDTree. To my surprise, Vim quickly cycled through all my tabs, opening each one, finally coming back to my current tab.

I don't know if this is a problem with nerdtree's odd mapping plugin setup, or with this repository. Also frustrating is there's no NERDTreeAddKeyMap so I have to restart Vim to undo it.

@fineven
Copy link

fineven commented Apr 8, 2015

I have the same problem.

@AndrewRayCode
Copy link
Author

Upon further usage, this does not appear to be caused by the NERDTreeAddKeyMap. It appears to just be happening now (which is odd as I don't think I recently updated nerdtree, nerdtree-tabs nor vim?)

@jordwalke
Copy link

This is the way this plugin is implemented. When originally implemented, I recall the author had a decision to make involving tradeoffs. The plugin could be implemented by either lazily sync'ing the NERDTree when switching to a different tab, or the plugin could sync it across all tabs every time it is toggled. The author (iirc) went with the later approach. At the time, I think it made sense - however now, cycling through many tabs has gotten to be much slower in vim (at least macVim). I wonder if it would be worth reevaluating the decision.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants