I'm trying to configure vim to understand the jest output error format to be able to include it in the quickfix list. Although it does work partly (at least getting the file name and line/column number), I don't know why the quick fix list is displaying the other lines that are not matched

Here's my error format:

CompilerSet makeprg=node_modules/.bin/jest
CompilerSet errorformat=%.%#\ at\ %.%#(%f:%l:%c)

Here's a sample error output for jest

‚óè But parseInt accepts radix as second argument

expect(received).toBe(expected) // Object.is equality

Expected: 4
Received: 3

  16 |     // parseInt uses the second argument to indicate radix
  17 |     expect(parseInt('3', 2)).toBe(NaN); // eslint-disable-line prefer-numeric-literals
> 18 |     expect(parseInt('11', 2)).toBe(4); // eslint-disable-line prefer-numeric-literals
     |                               ^
  19 |   });
  20 | 
  21 |   test('It could create problems when used as part of an higher-order function like map', () => {

  at Object.toBe (managing.functions.input.test.js:18:31)

I do this:

:compiler jest

when I do :copen after this, it opens the quick fix list and jumps to the first error -- all good here.. but it also shows me all the lines above from the output. Ideally, I expect only one line per error in the quickfix list.

Admittedly, I haven't encoded the error message (%m) yet, but to start with I don't want all the output lines to be shown in the quick fix window. My understanding is that if a line doesn't match any format, it should be skipped ..isn't it?

Can somebody help me how to do this?

Also, if I type :clist, it does show me only the error line(s) - I expect similar output in quick fix list.

Thanks in advance

1 Answer 1


After going through other options, I realised that the default of quickfix is to capture all the output and use %- prefix to skip any lines

after modifying the errorformat to

  CompilerSet errorformat=%.%#\ at\ %.%#(%f:%l:%c),%-G%.%#

it worked. But this worked only in vanilla vim - compiler,make combo.

I was using this as part of vim-dispatch and neo-vim adapter plugins and looks like neo-vim doesn't recognize the %-G option. so for this case converting it to %-A solved the problem for now.


  • I've tried this in "VIm" (instead of neo-vim) and even there %-G doesn't seem to work. only %-A worked. Not sure if it's the problem of dispatch plugin or the adapter (for dispatch) Sep 22, 2018 at 10:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.