简体   繁体   English

vim和NERD树:NERD树可以在MacVim的标签页中保留吗?

[英]vim and NERD Tree: Can NERD Tree persist across tabs in 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. 在MacVim上使用NERD Tree时,我可以在NERD树窗口中使用't'(或'T'在后台打开它)在新选项卡中打开文件,但是当我切换到该选项卡时,NERD树窗口不再可见,因为它保留在原始选项卡中。 Is there a way to automatically open NERD Tree in new tabs when opening files from NERD Tree in new tabs? 在新选项卡中打开NERD树中的文件时,有没有办法在新选项卡中自动打开NERD树? Or can NERD Tree persist across tabs? 或者NERD Tree可以在标签中持续存在吗?

This NERDTree behavior was a pain for me, too. 这种NERDTree行为对我来说也是一种痛苦。 It annoyed me so much that I learned VimScript and made a plugin that keeps NERDTree consistent across all tabs all the time. 它让我非常生气,以至于我学会了VimScript并制作了一个插件,让NERDTree始终在所有标签上保持一致。

You can grab it on Github: https://github.com/jistr/vim-nerdtree-tabs 你可以在Github上抓住它: https//github.com/jistr/vim-nerdtree-tabs

You can also use :NERDTreeMirror . 您还可以使用:NERDTreeMirror I prefer this to NERDTreeToggle when at least one tree is already open because it keeps the tree consistent across tabs. 当至少有一棵树已经打开时,我更喜欢NERDTreeToggle,因为它使树在选项卡之间保持一致。

The only persistent object in Vim is a buffer. Vim中唯一的持久对象是缓冲区。 Windows display buffers, tab pages organize windows. Windows显示缓冲区,标签页组织窗口。 If you want to open NERD Tree in the new tab, then call :NERDTreeToggle . 如果要在新选项卡中打开NERD树,请调用:NERDTreeToggle Another option would be to open a new tab, open NERD Tree, and then open the file in your freshly created tab. 另一种选择是打开一个新选项卡,打开NERD Tree,然后在新创建的选项卡中打开该文件。

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. 您可以映射要调用的键:NERDTreeToggle ,以便在您实际需要使用它时轻松使其可见。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM