Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

vim and NERD Tree: Can NERD Tree persist across tabs in MacVim?

Tags:

vim

macvim

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?

like image 458
Aaron Massey Avatar asked Feb 17 '10 18:02

Aaron Massey


People also ask

What is NERDTree in Vim?

The NERDTree is a file system explorer for the Vim editor. Using this plugin, users can visually browse complex directory hierarchies, quickly open files for reading or editing, and perform basic file system operations.

How do I switch back to NERDTree?

After having opened a new file from the tree in a new window press ctrl-w p to switch back to the NERDTree and use it again to return to your previous window.


2 Answers

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

like image 78
Jiří Stránský Avatar answered Oct 04 '22 09:10

Jiří Stránský


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.

like image 37
Alexander Avatar answered Oct 04 '22 08:10

Alexander