在使用 NERD Tree 时使用 VCSCommand 插件提交目录
我使用的是 vim 7.3、NERDTree 4.1 插件和 VCSCommand 版本 1.99.42。
要在 VCSCommand 中提交目录,您需要打开目录缓冲区(与目录上的所有命令相同),但是每当我尝试打开安装了 NERD Tree 插件的目录缓冲区时,它都会将该缓冲区引用为 Nerd_tree_* 而不是我需要进行相关提交的目录名称。
我该如何防止这种情况发生?如何打开安装了 NERD 树的标准目录缓冲区?如何定期关闭 NERD Tree 来执行命令?
注意:我知道这个 stackoverflow问题,开发者说他禁用了NERD Tree插件,因为他使用Command-T作为文件浏览器,但我想继续使用NERD Tree,没有提及在帮助中禁用 NERD Tree。
I am using vim 7.3, the NERDTree 4.1 plugin and VCSCommand version 1.99.42.
To commit a directory in VCSCommand you need have the directory buffer open (it's the same with all commands on directories), however whenever I try to open a directory buffer with the NERD Tree plugin installed it refers to the buffer as Nerd_tree_* and not the directory name which I need to make a relevant commit.
How do I prevent this from happening? How do I open a standard directory buffer with NERD tree installed? How do I turn NERD Tree off periodically to perform the command?
Note: I am aware of this stackoverflow question where the dev says he disabled the NERD Tree plugin because he was using Command-T as a file explorer, but I would like to continue to use NERD Tree, there is no mention of disabling NERD Tree in the help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
有一个解决方案,但需要一些编码。
您需要使用启用/禁用接口来更新 netrw 和 NERDTree 插件。
我为您创建了这个要点,其中有两个必须更改的文件。
文件本身也已附上。
通过此更改,您可以使用
禁用 NERD 并使 vim 使用 netrw (它是原始文件管理器)并
再次恢复 NERDTree。
当然,您还需要通过使用自己的包装函数或修改 VCS 本身来调用相关 VCS 命令之前和之后的函数。
希望这有帮助。
编辑 2011-03-17:
手动调用这些函数效果很好。即:
调用DisableNERDTree()
调用HijackNERTW()
我更新了补丁 以便这些功能可以以自动化的方式使用。
DisableNERDTree()
现在将目录更改为打开的目录。例如:There is a solution but it required some coding.
You need to update netrw and NERDTree plugins with kind of enable/disable interface.
I create this gist for you with two files that have to be changed.
The files itself are also attached.
With this change you can use
to disable NERD and make vim use netrw (it's original file manage) and
To restore NERDTree again.
Of course you alsoneed do call the functions before and after related VCS command either by using your own wrapper functions or modifying VCS itself.
Hope this helped.
Edit 2011-03-17:
Calling those functions manually works well. I.e:
call DisableNERDTree()
call HijackNERTW()
I updated the patch so those functions could be used in automated way.
DisableNERDTree()
now changes directory to the one opened. E.g.:我使用一个简单的组合:
当我计划递归 Diff 或递归 Commit 时 - 我运行命令 :Hexplore,该命令在拆分窗口中打开 netrw,导航到必要的目录并运行 :VCSCommit 或 :VCSDiff。这是一个简单的修复,无需额外的更改或复杂的操作:)。
I use a simple combination:
When I'm planning for recursive Diff or recursive Commit - I run command :Hexplore, which opens netrw in split-window, navigate to necessary directory and run :VCSCommit or :VCSDiff. That's a simple fix without additional changes or complex manipulations :).
Devemouse 的更改和函数示例允许我构建以下 2 个包装函数,它们执行 VCS 命令,然后将 vim 返回到之前的状态
Devemouse changes and function example allowed me to construct the following 2 wrapper functions, which perform VCS command and then returns vim to it's previous state