%20%E9%8C%AF%E8%AA%A4.png)
"~/Desktop/project/file.txt" [readonly] 81L, 2480C
Error detected while processing command line:
E344: Can't find directory "src/" in cdpath
E472: Command failed
Press ENTER or type command to continue
^ 在打開每個文件之前都會彈出此錯誤。我不知道錯誤從哪裡來,因為它說... while processing command line:
,然後它是空白的......
我用來呼叫它的命令是git difftool
另外,當我調用它時,我所在的目錄是~/Desktop/project/src
,我認為這是它獲取Can't find directory "src/"
.
答案1
我在使用 git difftool 時遇到了類似的問題。檢查您的.vimrc
或 插件lcd %:p:h
。我透過在調用時添加以下內容解決了該問題lcd %:p:h
:
if !&diff
lcd %:p:h
endif
答案2
看起來Git正在vimdiff
從~/Desktop/project
目錄調用,並將文件傳遞為src/...
這樣的相對路徑,Vim將查閱設置'cdpath'
,並且那裡的任何內容都沒有src/
目錄,因此會發生錯誤(從命令行) 。
Git 的正確方法是使用./src/...
或絕對路徑,但這可能很難更改。相反,您可以透過環境變數影響 Vim 的預設值CDPATH
,或直接輸入:set cdpath=
來~/.vimrc
實際停用這些查找。