4
的文檔,Vim的system
函數表示,這對第二個參數:如何使用系統的第二個參數(輸入)()函數
當{輸入}給出,這個字符串寫入一個文件,作爲stdin傳遞給命令。
我從明白那是什麼,如果你的system
調用是這樣的:
call system('node something.js --file', 'here is some text')
執行看起來像這樣的命令:
node something.js --file some/temp/file
和some/temp/file
將有文字here is some text
作爲其內容。爲了測試這個,我跑了Vim命令(第二行是結果):
:echo system('cat', 'here is some text')
here is some text
好吧,這看起來正確的。第二個測試:
:echo system('echo', 'here is some text')
<blank line>
而不是獲取一些臨時文件的名稱,我有一個空行。此外,當我在我的node.js腳本中打印process.argv
時,我只得到['node', 'path/to/something.js', '--file']
。
我錯過了{input}
參數如何使用?似乎爲cat
工作,但不是echo
或我自己的腳本?
嘿downvoter。介意告訴我如何改善我的問題? – benekastah 2013-09-03 18:46:34