I'm trying to lint my C files inside vim. I know that quickfix should help in this case. I found the following pc-lint file maintained by Craig Emery. I have this file in vim/vim80/compiler.

if exists("current_compiler")
let current_compiler = "pc-lint"

if exists(":CompilerSet") != 2      " older Vim always used :setlocal
  command -nargs=* CompilerSet setlocal <args>

CompilerSet makeprg=C:\Users\ahmes\PCLint\LIN.bat

CompilerSet errorformat=%A%f(%l\\,%c):\ %t%*[^\ ]\ %n:\ %m,%C%p_,%Z%s,%t%*[\ ]\ %n:\ %m\ (line\ %l\\,\ file\ %f)%*[^`]

When I open quickfix using :copen after running :make % and hit enter inside quickfix buffer, the current line is highlighted but it doesn't jump to the error location in the source file.

Another thing is that :cp and :cn just jump to the next/previous line in quickfix buffer and not to next/previous error.

I've read this similar question, but this is not my case as is not mapped to anything in my vimrc.

How can I jump to error location inside the source file using quickfix?


I tried playing arround with pc-lint file. I've changed errorformat to be the following:

CompilerSet errorformat=%f:%m

After running :make %, the opened source file was closed and a new empty buffer was opened. Then I run :copen, and the quickfix list opened up and I could navigate between errors using :cn and :cp. When I hit enter on an error, the cursor moves to the empty new-opened buffer claiming in the status bar that it is the source file?

By the way, I'm working on a Windows OS.

1 Answer 1


After reading and trials, I understood where is the problem.

PC-Lint (the linting tool I use) produces messages in specific format. For example, first comes the name of the file where the error is located %f, then comes the line number %l, then the message itself %m. This message format can be configured in PC-Lint.

On the other hand, quickfix should be configured so that the message format it expects is the same as the message format PC-Lint produces. This way, quickfix can know what is the file name, which line has the problem and so on.

The bottom line is, quickfix uses its errorformat to interpret the PC-Lint's messages and not to display them (as I thought before).

So the solution is to configure PC-Lint and Quickfix so that their message formats match.

This file is provided by Gimpel (PC-Lint developer) and it helps in clarifying the solution.

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.