vim-nerdtree-tabs icon indicating copy to clipboard operation
vim-nerdtree-tabs copied to clipboard

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

Open AndrewRayCode opened this issue 9 years ago • 3 comments

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.

AndrewRayCode avatar Feb 26 '15 17:02 AndrewRayCode

I have the same problem.

fineven avatar Apr 08 '15 16:04 fineven

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?)

AndrewRayCode avatar Apr 15 '15 20:04 AndrewRayCode

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.

jordwalke avatar Dec 26 '16 06:12 jordwalke