NerdTree のルート ディレクトリを変更するたびに、CtrlP 検索ディレクトリが動的に変更されるようにします。
プラグイン間の通信はvimでどのように機能しますか?
まったく機能しません。Vim は、プラグインの作成者がプラグインをシームレスに連携させるのに役立つ共通のインターフェイスを公開していません。いつか…</p>
それまでの間、リバース エンジニアリング、ソース コードの読み取り、そしていつものように RTFM が残っています。
NERDTreeChDirMode
Vim の「現在のディレクトリ」の変更に関するプラグインの動作を指示するNERDTree のオプション:
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.
したがって、以下の2つのオプションで必要なものが得られるようです。
let g:NERDTreeChDirMode = 2
let g:ctrlp_working_path_mode = 'rw'