2
很容易使用vimscript來確定是否使用argc()
將文件名指定爲vim。有沒有一種方法可以確定-
標誌是否給出了指定給vim的管道輸入?它不會將管道輸入作爲文件名計數,並且argc()
爲空。vimscript檢測管道輸入
編輯
由於下面的精彩接受的答案,我有辦法打開NerdTree如果沒有文件名沒有被使用和 stndin。
let wmuse_nt = 0
autocmd StdinReadPost * let wmuse_nt = 1
autocmd vimenter * if !argc() && wmuse_nt == 0 | NERDTree | endif
不錯!我認爲你應該從你的問題中拿出「編輯」部分,並將其作爲自我回答加入。 – yshavit