Vim errorformat:使用%D更改目录

时间:2011-06-02 23:44:10

标签: vim errorformat

当目前的目录是带有错误的文件的目录的兄弟时,我很难找到正确的Vim errorformat。例如:

errorformat
errorformat/model
errorformat/spec

Vim的makeprg选项设置为在errorformat/spec中执行文件。我从errorformat/model运行make。 Vim设置为使用当前文件的目录作为工作目录。

要测试,我在errorformat/model/errorformat.vim

中运行以下内容
set makeprg=ruby\ ~/errorformat/spec/errorformat_spec.rb
let &efm="%D%f,%f:%l"
make!
copen

正如您所看到的,它在兄弟目录中运行一个Ruby文件,它只是

puts %{errorformat}
puts %{./spec/errorformat_spec.rb:1}
exit 5

期望的效果是,当我从其他目录运行规范时,Vim将使用%D中的errorformat让我打开spec文件。但它不起作用。特别是,我似乎无法让%D%f做我期望的事情。当我运行此测试时,QuickFix窗口显示

|| errorformat
|| ./spec/errorformat_spec.rb:1

双条表示%D%f的{​​{1}}部分未识别输出。这似乎也阻止了errorformat部分解释下一行。

我必须有一些非常简单的东西!

1 个答案:

答案 0 :(得分:1)

问题在于errorformat的顺序。在%D%f部分之后,%f:%l部分需要