Vim errorformat: using% D to change directory

I am trying to find the correct Vim errorformat to use when the current directory is a child of the directory with the error file. For instance:

 errorformat errorformat/model errorformat/spec 

Vim makeprg parameter is set to execute the file in errorformat/spec . I run make from errorformat/model . Vim is configured to use the current file directory as the working directory.

To check, I run the following in errorformat/model/errorformat.vim

 set makeprg=ruby\ ~/errorformat/spec/errorformat_spec.rb let &efm="%D%f,%f:%l" make! copen 

As you can see, this runs the Ruby file in the sibling directory, which simply executes

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

The desired effect is that when I run the specification from another directory, Vim will use %D in errorformat so that I can open the specification file. But that does not work. In particular, I just can't get %D%f to do what I expect. When I run this test, the QuickFix window shows

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

Double columns indicate that the %D%f errorformat does not recognize the output. This also prevents the next line from being interpreted as part of %f:%l .

There must be something very simple that I am missing!

+4
source share
1 answer

The problem was the error order. The %D%f should have been after %f:%l .

+1
source

All Articles