2014-02-19 47 views

回答

20

它不起作用根本沒有。 Vim根本沒有公開可以幫助插件作者無縫銜接的插件。也許有一天...

與此同時,我們還剩下逆向工程,閱讀源代碼和一如既往,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' 
+0

優秀的描述,謝謝@romainl – Nozim