防止在 Vim 中的 NERDTree 或 MiniBuffExplorer 窗口中打开文件 [英] Prevent opening files inside NERDTree or MiniBuffExplorer windows in Vim
问题描述
我发现自己在 Vim 中错误的窗口中打开文件——有时是 NERDTree 或 MiniBuffExplorer——这真的让我很失望.
I find myself opening files inside the wrong window in Vim — sometimes the NERDTree or MiniBuffExplorer — and it’s really throwing me off.
我确定这是因为我的光标错误地集中在这些窗口之一内,但是我可以在我的 .vimrc
文件中添加任何内容来防止这种情况发生吗?
I’m sure it’s happening because my cursor is mistakenly focused inside one of these windows, but is there anything I can add to my .vimrc
file to prevent this from happening?
推荐答案
我终于在 MiniBufExplorer 源评论中找到了解决这个烦恼的方法.看起来这个功能从 6.2.8 版(2004-06-07 发布)开始就可用了:
I finally found the solution to this annoyance in the MiniBufExplorer source comments. It looks like this feature has been available since version 6.2.8 (release 2004-06-07):
如果您使用其他资源管理器,例如 TagList,您可以(从 6.2.8 开始)放置:
If you use other explorers like TagList you can (As of 6.2.8) put:
let g:miniBufExplModSelTarget = 1
进入您的 .vimrc 以强制 MBE 尝试放置选定的位置缓冲到没有不可修改缓冲区的窗口中.这样做的结果应该是,如果您进入 MBE 并选择缓冲区,缓冲区不应出现在托管浏览器.
into your .vimrc in order to force MBE to try to place selected buffers into a window that does not have a nonmodifiable buffer. The upshot of this should be that if you go into MBE and select a buffer, the buffer should not show up in a window that is hosting an explorer.
这篇关于防止在 Vim 中的 NERDTree 或 MiniBuffExplorer 窗口中打开文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!