Search code examples
vimerrorformat

Vim errorformat and jslint


I am trying to get makeprg and errorformat working with VIM and jslint, and can't seem to get the error format right for the life of me... I am using the nodejs version of jslint which produces results like:

1 116,9: The body of a for in should be wrapped in an if statement to filter unwanted properties from the prototype.
    for (var k in o)

I basically want to match the line number, and column and the error and use the current file for the filename. Anyone know how to do this?

To be clear, I am looking for the errorformat to get this command working. Currently my .vimrc file has

augroup js
    set makeprg=jslint\ %
    set errorformat=%E%>%l,%c:%m,%Z
augroup END

which just isn't working (the jslint works fine, but the errorformat is wrong)...


Solution

  • I actually just stuck JSLint into my makeprg earlier today, and naturally I needed some quickfix support.

    I created a branch of node-jslint which outputs JSLint's errors in a GCC-like format. The efm is: %f:%l:%c:%m. If you can use node.js, I recommend using node-jslint (especially if you're working on a node.js/CommonJS project).

    As for your original problem: I don't think %> is necessary. If removing that doesn't help, try simply the following:

    set efm=%l,%c: %m