我希望CtrlP搜索目录可以随时更改NerdTree的根目录而动态更改。
插件到插件的通信在Vim中如何工作?
最佳答案
它根本不起作用。 Vim根本没有公开将帮助插件作者使他们的插件无缝协作的通用接口(interface)。可能有一天…
同时,我们还有逆向工程,读取源代码以及一如既往的RTFM。
NERDTree的NERDTreeChDirMode
选项,指示插件在更改Vim的“当前目录”方面的行为:
If the option is set to 2 then it behaves the same as if set to 1 except that
the CWD is changed whenever the tree root is changed. For example, if the CWD
is /home/marty/foobar and you make the node for /home/marty/foobar/baz the new
root then the CWD will become /home/marty/foobar/baz.
在CtrlP一侧,
ctrlp_working_path_mode
选项听起来很有趣:w - begin finding a root from the current working directory outside of CtrlP
instead of from the directory of the current file (default). Only applies
when "r" is also present.
这样看来,以下两个选项将为您提供所需的内容:
let g:NERDTreeChDirMode = 2
let g:ctrlp_working_path_mode = 'rw'
关于vim - 如何根据NerdTree的根目录更改CtrlP的搜索目录?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/21888869/