Question

When using NERD Tree on MacVim, I can open a file in a new tab by using 't' (or 'T' to open it in the background) in the NERD Tree window, but when I switch to that tab, the NERD Tree window is no longer visible since it remains in the original tab. Is there a way to automatically open NERD Tree in new tabs when opening files from NERD Tree in new tabs? Or can NERD Tree persist across tabs?

Was it helpful?

Solution

You can also use :NERDTreeMirror. I prefer this to NERDTreeToggle when at least one tree is already open because it keeps the tree consistent across tabs.

OTHER TIPS

This NERDTree behavior was a pain for me, too. It annoyed me so much that I learned VimScript and made a plugin that keeps NERDTree consistent across all tabs all the time.

You can grab it on Github: https://github.com/jistr/vim-nerdtree-tabs

The only persistent object in Vim is a buffer. Windows display buffers, tab pages organize windows. If you want to open NERD Tree in the new tab, then call :NERDTreeToggle. Another option would be to open a new tab, open NERD Tree, and then open the file in your freshly created tab.

I wonder, though, why you would want to have a file tree open all the time. It's just a waste of space, most of the time. You can map a key to call :NERDTreeToggle to easily make it visible when you actually need to use it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top