2009-11-07 116 views

回答

35

找到答案由于上的用户vim的使用邮件列表:

:let @a = system("ls -l")

为了与光标下的文件作为参数运行命令:

:let @a = system("ls -l " . shellescape(expand('<cfile>')))

+2

这是明智构建外壳命令时要使用的'shellescape()'函数。在这个例子中,':let @a = system(“ls -l”。shellescape('')))''。 – jamessan 2010-01-25 15:38:50

+1

好点,更新答案 – 2010-01-25 19:59:19