vim-nerdtree-tabs
vim-nerdtree-tabs copied to clipboard
Adding a mapping with NERDTreeAddKeyMap makes toggling nerdtree cycle through all tabs
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.
I have the same problem.
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?)
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.