vim 和 NERD Tree:NERD Tree 能否在 MacVim 中跨选项卡持久存在?
在 MacVim 上使用 NERD Tree 时,我可以在 NERD Tree 窗口中使用“t”(或“T”在后台打开它)在新选项卡中打开文件,但是当我切换到该选项卡时,NERD Tree窗口不再可见,因为它保留在原始选项卡中。在新选项卡中打开 NERD Tree 中的文件时,有没有办法自动在新选项卡中打开 NERD Tree?或者 NERD Tree 可以跨选项卡持久存在吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您还可以使用
:NERDTreeMirror
。当至少一棵树已经打开时,我更喜欢这个而不是 NERDTreeToggle,因为它使树在选项卡之间保持一致。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.Vim 中唯一持久的对象是缓冲区。窗口显示缓冲区,选项卡页组织窗口。如果您想在新选项卡中打开 NERD Tree,请调用
:NERDTreeToggle
。另一种选择是打开一个新选项卡,打开 NERD Tree,然后在新创建的选项卡中打开该文件。不过,我想知道为什么你想要一直打开文件树。大多数时候,这只是浪费空间。您可以映射一个键来调用
:NERDTreeToggle
,以便在您实际需要使用它时轻松使其可见。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.这种 NERDTree 行为对我来说也是一种痛苦。这让我非常恼火,所以我学习了 VimScript 并制作了一个插件,使 NERDTree 在所有选项卡中始终保持一致。
你可以在 Github 上获取它: https://github.com/jistr/vim-nerdtree-tabs< /a>
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